Article ID: 937214 - Last Review: December 3, 2007 - Revision: 1.1

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

System TipThis article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
Expand all | Collapse all

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.

REFERENCES

For more information about the IDisposable.Dispose method in the .NET Framework 2.0 SDK, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/system.idisposable.dispose(vs.80).aspx (http://msdn2.microsoft.com/en-us/library/system.idisposable.dispose(vs.80).aspx)
For more information about the IDisposable interface in the .NET Framework 2.0 SDK, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/system.idisposable(vs.80).aspx (http://msdn2.microsoft.com/en-us/library/system.idisposable(vs.80).aspx)

APPLIES TO
  • Microsoft .NET Framework 2.0
Keywords: 
kbinfo kbtshoot KB937214