The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

IsolatedStorageFile.DeleteFile Method

Deletes a file in the isolated store.

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)
public void DeleteFile(
	string file


Type: System.String
The relative path of the file to delete within the isolated store.

The store has been removed.


Unable to delete the file.


Isolated storage is disabled.


file is badly formed.


file is null.


The store has been disposed.

The deleted file cannot be recovered once deleted.


File deletions are subject to intermittent failures because files can be in use simultaneously by operating system features such as virus scanners and file indexers. This is especially true for recently created files. Macintosh users should be aware of this issue because of its frequent indexing.

For these reasons, it is important to add code to the code block that handles the IsolatedStorageException to retry deleting the file or log a failure.

The following example deletes a file from the store. This example is part of a larger example provided for IsolatedStorageFile class.

// Delete a file.
    if (store.FileExists(filePath))
catch (IsolatedStorageException ex)


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

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.