IsolatedStorageFile.Remove Metoda

Definicja

Usuwa izolowany zakres magazynu i całą jego zawartość.

Przeciążenia

Remove()

Usuwa izolowany zakres magazynu i całą jego zawartość.

Remove(IsolatedStorageScope)

Usuwa określony izolowany zakres magazynu dla wszystkich tożsamości.

Remove()

Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs

Usuwa izolowany zakres magazynu i całą jego zawartość.

public:
 override void Remove();
public override void Remove ();
override this.Remove : unit -> unit
Public Overrides Sub Remove ()

Wyjątki

Nie można usunąć wydzielonego magazynu.

Przykłady

W poniższym przykładzie kodu użyto Remove metody w celu usunięcia izolowanego pliku magazynu po opróżnieniu jego zawartości. Przykład Instrukcje: usuwanie magazynów w izolowanym magazynie pokazuje również użycie Remove metody .

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

Uwagi

Przestroga

Ta metoda nieodwołalnie usuwa cały zakres i wszystkie zawarte katalogi i pliki.

Jeśli którykolwiek z katalogów lub plików w magazynie jest używany, próba usunięcia sklepu zakończy się niepowodzeniem i magazyn zostanie oznaczony do usunięcia. Wszelkie kolejne próby zmodyfikowania magazynu zgłaszają błąd IsolatedStorageException.

Zobacz też

Dotyczy

Remove(IsolatedStorageScope)

Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs

Usuwa określony izolowany zakres magazynu dla wszystkich tożsamości.

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)

Parametry

scope
IsolatedStorageScope

Bitowa kombinacja IsolatedStorageScope wartości.

Wyjątki

Nie można usunąć wydzielonego magazynu.

Uwagi

Przestroga

Ta metoda nieodwołalnie usuwa cały zakres i wszystkie zawarte katalogi i pliki.

Jeśli którykolwiek z katalogów lub plików w magazynie jest używany, próba usunięcia sklepu zakończy się niepowodzeniem i magazyn zostanie oznaczony do usunięcia. Wszelkie kolejne próby zmodyfikowania magazynu zgłaszają błąd IsolatedStorageException.

Zobacz też

Dotyczy