What does dispose() do?
please explain.
thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sam HobbsRank #107 · 20.5K reputationPosted Aug 2, 2010, 9:21 AM EDT
In C# and Java objects are clened up using garbage collection. Garbage collection is supposed to make things easier but there are things such as Dispose and Finalize that are really complicated and confusing. Generally speaking, you don't need to implement Dispose for managed objects. Dispose is usually used when there are unmanaged resources that need to be deleted or freed.
Note that your question is very vague; I hve already spent much more time answering than you spent asking. If you want a more specific answer then spend the time to create a more specific question. Also spend time reading relevant articles and other resources.
Tanmay SarkarRank #1,407 · 1.2K reputationPosted Aug 1, 2010, 7:09 PM EDT
http://www.csharphelp.com/2007/05/avoid-c-memory-leaks-with-destructor-and-dispose/
probably you get your answer.
Thank you.
Please mark it as answer if it help you!
Majid KamaliRank #6,453 · 266 reputationPosted Aug 2, 2010, 1:16 AM EDT
Is dispose() equivalent to 'delete' keyword in C++ ?
What is difference between dispose() and a destructor ?
Tanmay SarkarRank #1,407 · 1.2K reputationPosted Aug 2, 2010, 1:37 AM EDT
where destructor() dealocate the alocate memory & it is automatically call by Garbage collector.
I say it from my little knowledge. if any body has better idea/explanation than write it.
Thank you!
All over If it help you please mark it as an answer.