Understand C#: Proper use IDisposable and using keyword
The System.IDisposable interface is a very useful interface to understand if you are concerned about performance in your application. Microsoft says the following about the IDisposable interface: 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. ...