Microsoft KB Archive/937214

= In the .NET Framework 2.0 SDK, you must explicitly call the IDisposable.Dispose method for all the System.Drawing objects =

Article ID: 937214

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 2.0

-



INTRODUCTION
In the Microsoft .NET Framework version 2.0 SDK, you must explicitly call the IDisposable.Dispose method for all the System.Drawing objects that are created by an application. You must do this before the objects go out of scope.

Note Most of the System.Drawing objects contain unmanaged Microsoft Graphics Device Interface (GDI) resources. Additionally, most of the System.Drawing objects implement the IDisposable interface.



MORE INFORMATION
You must explicitly call the IDisposable.Dispose method for the objects that implement the IDisposable interface.

You do not have to explicitly call the IDisposable.Dispose method if the object constructor is called in the expression of a using statement. A using statement defines a scope, and the object is automatically disposed of at the end of the scope.

