This blog shows on how Idisposable is used for.

Idisposable is of

· The primary use of this interface is to release unmanaged resources. The garbage collector automatically releases the memory allocated to a managed object when that object is no longer used.

· However, it is not possible to predict when garbage collection will occur.

· Furthermore, the garbage collector has no knowledge of unmanaged resources such as window handles, or open files and streams.

· The consumer of an object can call this method when the object is no longer needed.