I have a bunch of custom types that, for one reason or another, need to implement IDisposable. I want to make sure that the other developers on my team using this class always dispose of my types correctly. What can I do to warn one of my teammates if he forgets to call Dispose?

In the October issue of MSDN Magazine, Stephen Toub answers this question, explaining why you should avoid implementing finalizers on your types unless you absolutely have to, and how to call dispose correctly if you really must.

For more .NET programming guidance from Stephen, check out our past .NET Matters column archives or subscribe to the RSS Feed for notice of new installments.

Enjoy!

 

Technorati Tags: ,