IsolatedStorageFile.Remove 方法

定義

移除隔離儲存區範圍和所有內容。

多載

Remove()

移除隔離儲存區範圍和所有內容。

Remove(IsolatedStorageScope)

移除所有識別的指定隔離儲存區範圍。

Remove()

來源:
IsolatedStorageFile.cs
來源:
IsolatedStorageFile.cs
來源:
IsolatedStorageFile.cs

移除隔離儲存區範圍和所有內容。

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

例外狀況

隔離存放區不能刪除。

範例

下列程式碼範例會 Remove 使用 方法,在其內容已清空之後刪除隔離儲存檔案。 如何:刪除隔離儲存區中的存放區範例也會示範方法的使用 Remove 方式。

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

備註

警告

這個方法無法撤銷地移除整個範圍和所有自主目錄和檔案。

如果存放區中的任何目錄或檔案正在使用中,則存放區的移除嘗試會失敗,且存放區會標示為移除。 任何後續嘗試修改存放區都會擲回 IsolatedStorageException

另請參閱

適用於

Remove(IsolatedStorageScope)

來源:
IsolatedStorageFile.cs
來源:
IsolatedStorageFile.cs
來源:
IsolatedStorageFile.cs

移除所有識別的指定隔離儲存區範圍。

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)

參數

scope
IsolatedStorageScope

IsolatedStorageScope 值的位元組合。

例外狀況

隔離存放區不能移除。

備註

警告

這個方法無法撤銷地移除整個範圍和所有自主目錄和檔案。

如果存放區中的任何目錄或檔案正在使用中,則存放區的移除嘗試會失敗,且存放區會標示為移除。 任何後續嘗試修改存放區都會擲回 IsolatedStorageException

另請參閱

適用於