IsolatedStorageFile.Dispose Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Releases all resources used by the IsolatedStorageFile.
Namespace: System.IO.IsolatedStorage
Assembly: mscorlib (in mscorlib.dll)
Remarks
As a rule, when you use an IDisposable object such as IsolatedStorageFile, you should declare and instantiate it in a using statement. The using statement calls the Dispose method on the object in the correct way, and it also causes the object itself to go out of scope as soon as Dispose is called. Within the using block, the object is read-only and cannot be modified or reassigned. For an example, see the example provided for IsolatedStorageFile class
If you don't use a using statement, always call Dispose when you are finished using the IsolatedStorageFile. The Dispose method leaves the IsolatedStorageFile in an unusable state. After calling Dispose, you must release all references to the IsolatedStorageFile so the garbage collector can reclaim the memory that IsolatedStorageFile was occupying.
Note: |
---|
Always call Dispose before you release your last reference to the IsolatedStorageFile. Otherwise, the resources the IsolatedStorageFileStream is using will not be freed until garbage collection calls the IsolatedStorageFileStream object's Finalize method. |
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.