Redigeeri

Jagamisviis:


IsolatedStorageFile.Remove Method

Definition

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

Removes the isolated storage scope and all its contents.

public:
 override void Remove();
public override void Remove ();
override this.Remove : unit -> unit
Public 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.

array<String^>^dirNames = isoFile->GetDirectoryNames( "*" );
array<String^>^fileNames = isoFile->GetFileNames( "*" );

// List directories currently in this Isolated Storage.
if ( dirNames->Length > 0 )
{
   for ( int i = 0; i < dirNames->Length; ++i )
   {
      Console::WriteLine( "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( "File Name: {0}", fileNames[ i ] );

   }
}
    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

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 -> unit
Public 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.

See also

Applies to