語言

IsolatedStorageFile.Remove 方法

定義

移除隔離儲存範圍及其所有內容。

多載

名稱 Description
Remove()

移除隔離儲存範圍及其所有內容。

Remove(IsolatedStorageScope)

移除所有身份的指定隔離儲存範圍。

Remove()

來源:
IsolatedStorageFile.cs
來源:
IsolatedStorageFile.cs
來源:
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方法的使用。

    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
來源:
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。

另請參閱

適用於