Implementing Dispose()

A best practice when you create a classthat uses unmanaged resources is to implement the Dispose() method of the IDisposable interface. Even if your class is not using unmanaged resources directly but contains members that do (i.e. ADO.Net objects), it’s a good idea to implement Dispose() to call Dispose() on those members.

In order to properly implement Dispose(), you have to follow some rules. You can find an example of how to go about this in this MSDN library article on implementing Dispose() and Finalize().