How to destroy an object?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 9, 2013, 7:43 AM EDT
If an object has a Dispose() method, you need to call it before it goes out of scope. You can use the using keyword to do this for you automatically
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 9, 2013, 7:45 AM EDT
http://www.codeproject.com/Articles/7792/Destructors-in-C
VulpesRank #55 · 29.2K reputationPosted Jul 9, 2013, 8:05 AM EDT
Alternatively, you can force an immediate garbage collection by calling GC.Collect().