IDisposable Interface
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Defines a method to release allocated resources.
Assembly: mscorlib (in mscorlib.dll)
The IDisposable type exposes the following members.
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.
Most Windows Phone apps consume unmanaged resources only when you access isolated storage with the IsolatedStorageFile class. A good practice is to use the using statement (Using in Visual Basic) with classes that use unmanaged resources, because the using statement calls Dispose for you after your code is finished with the object. For an example of the using statement being used with the IsolatedStorageFile class, see Data for Windows Phone 8.
