This topic has not yet been rated - Rate this topic

IsolatedStorageFile.Dispose Method

April 12, 2014

Releases all resources used by the IsolatedStorageFile.

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)
public void Dispose()

Implements

IDisposable.Dispose()

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.

NoteNote:

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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.