CELEBRATE EARTH WEEK
Save 70% on video training and simulators now through April 27*—use code EARTH. Shop now.
The point of IDisposable, as you probably know, is to simplify the problem of releasing unmanaged resources in .NET programs. It's a simple concept that is much covered in the .NET documentation and by articles in the trade press. It only takes a few minutes to learn how to use the IDisposable interface and from what I've seen, programmers intuitively understand why it's important.
Implementing the IDisposable interface in a custom class, however, contains some pitfalls for the unwary, as Shawn Farkas points out in the CLR Inside Out column in the July 2007 issue of MSDN Magazine.
The article explains the reason for IDisposable, shows how to use it, and gives very readable instructions for implementing the interface in your classes, including how to handle deriving from a class that implements IDisposable. All in all, it's among the better articles I've seen on the topic, and well worth reading for any .NET developer.
Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.