Export (0) Print
Expand All

IsolatedStorageFile.Remove Method

Removes the isolated storage scope and all its contents.

Overload List

Removes the isolated storage scope and all its contents.

[Visual Basic] Overloads Overrides Public Sub Remove()
[C#] public override void Remove();
[C++] public: void Remove();
[JScript] public override function Remove();

Removes the specified isolated storage scope for all identities.

[Visual Basic] Overloads Public Shared Sub Remove(IsolatedStorageScope)
[C#] public static void Remove(IsolatedStorageScope);
[C++] public: static void Remove(IsolatedStorageScope);
[JScript] public static function Remove(IsolatedStorageScope);

Example

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Remove. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
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

[C#] 
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());
            }

[C++] 
String* dirNames[]  = isoFile->GetDirectoryNames(S"*");
String* fileNames[] = isoFile->GetFileNames(S"*");

// List directories currently in this Isolated Storage.
if (dirNames->Length>0)
{
   for (int i=0;i<dirNames->Length;++i) 
   {
      Console::WriteLine(S"Directory Name: {0}", dirNames[i]);
   }
}

// 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)
{
   for (int i=0;i<fileNames->Length;++i) 
   {
      Console::WriteLine(S"File Name: {0}", fileNames[i]);
   }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

IsolatedStorageFile Class | IsolatedStorageFile Members | System.IO.IsolatedStorage Namespace

Show:
© 2015 Microsoft