المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Explicitly call IDispose() method



C# Programming
07-09-2009, 12:11 AM
Hello all,

Does anyone know if the Dispose() method must be explicity called on every object that implements IDispose? In other words, will the Garbage collector call the Dispose() method when the object's life expires. Don't get me wrong, I know that it's good practice to clean up your own trash but I didn't know how serious of a memory leak this issue is.

In addition to that, what about un-wiring event handlers from a class before it's reference is set to null? I've code that removes handlers and code that doesn't.

Any thoughts?

The hurrier I go, the behinder I get.