Home > Blogs > New IDisposable Article

New IDisposable Article

By  Aug 7, 2007

Topics: Programming, Windows Programming

The .NET IDisposable interface, as simple as it seems, continues to be a source of confusion for new and experienced developers alike.  Shawn Farkas sheds a little more light on IDisposable in the CLR Inside Out article of the July 2007 MSDN Magazine.

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.

Become an InformIT Member

Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.