IsolatedStorageFile.Remove Method   
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes the isolated storage scope and all its contents.
Overloads
| Remove() | Removes the isolated storage scope and all its contents. | 
| Remove(IsolatedStorageScope) | Removes the specified isolated storage scope for all identities. | 
Remove()
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
Removes the isolated storage scope and all its contents.
public:
 override void Remove();public override void Remove();override this.Remove : unit -> unitPublic Overrides Sub Remove ()Exceptions
The isolated store cannot be deleted.
Examples
The following code example uses the Remove method to delete the isolated storage file after its contents have been emptied. The How to: Delete Stores in Isolated Storage example also demonstrates the use of the Remove method.
    String[] dirNames = isoFile.GetDirectoryNames("*");
    String[] fileNames = isoFile.GetFileNames("Archive\\*");
    // Delete all the files currently in the Archive directory.
    if (fileNames.Length > 0)
    {
        for (int i = 0; i < fileNames.Length; ++i)
        {
            // Delete the files.
            isoFile.DeleteFile("Archive\\" + fileNames[i]);
        }
        // Confirm that no files remain.
        fileNames = isoFile.GetFileNames("Archive\\*");
    }
    if (dirNames.Length > 0)
    {
        for (int i = 0; i < dirNames.Length; ++i)
        {
            // Delete the Archive directory.
        }
    }
    dirNames = isoFile.GetDirectoryNames("*");
    isoFile.Remove();
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}
Dim dirNames As String() = isoFile.GetDirectoryNames("*")
Dim fileNames As String() = isoFile.GetFileNames("*")
Dim name As String
' List directories currently in this Isolated Storage.
If dirNames.Length > 0 Then
    For Each name In dirNames
        Console.WriteLine("Directory Name: " & name)
    Next name
End If
' List the files currently in this Isolated Storage.
' The list represents all users who have personal preferences stored for this application.
If fileNames.Length > 0 Then
    For Each name In fileNames
        Console.WriteLine("File Name: " & name)
    Next name
End If
Remarks
Caution
This method irrevocably removes the entire scope and all contained directories and files.
If any of the directories or files in the store are in use, the removal attempt for the store fails and the store is marked for removal. Any subsequent attempts to modify the store throw an IsolatedStorageException.
See also
Applies to
Remove(IsolatedStorageScope)
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
Removes the specified isolated storage scope for all identities.
public:
 static void Remove(System::IO::IsolatedStorage::IsolatedStorageScope scope);public static void Remove(System.IO.IsolatedStorage.IsolatedStorageScope scope);static member Remove : System.IO.IsolatedStorage.IsolatedStorageScope -> unitPublic Shared Sub Remove (scope As IsolatedStorageScope)Parameters
- scope
- IsolatedStorageScope
A bitwise combination of the IsolatedStorageScope values.
Exceptions
The isolated store cannot be removed.
Remarks
Caution
This method irrevocably removes the entire scope and all contained directories and files.
If any of the directories or files in the store are in use, the removal attempt for the store fails and the store is marked for removal. Any subsequent attempts to modify the store throw an IsolatedStorageException.