IsolatedStorageFile.Remove 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
删除独立存储范围及其所有内容。
重载
| 名称 | 说明 |
|---|---|
| Remove() |
删除独立存储范围及其所有内容。 |
| Remove(IsolatedStorageScope) |
删除所有标识的指定隔离存储范围。 |
Remove()
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
删除独立存储范围及其所有内容。
public:
override void Remove();
public override void Remove();
override this.Remove : unit -> unit
Public Overrides Sub Remove ()
例外
无法删除隔离存储。
示例
下面的代码示例使用 Remove 该方法在将其内容清空后删除独立存储文件。 How to: Delete Stores in Isolated Storage examples also demonstrates the use of the Remove method.
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
注解
Caution
此方法不可撤销地删除整个范围以及所有包含的目录和文件。
如果存储区中的任何目录或文件正在使用中,则存储的删除尝试将失败,并且存储将被标记为删除。 任何修改存储的后续尝试都引发 。IsolatedStorageException
另请参阅
适用于
Remove(IsolatedStorageScope)
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- IsolatedStorageFile.cs
- Source:
- 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 。
例外
无法删除独立存储区。
注解
Caution
此方法不可撤销地删除整个范围以及所有包含的目录和文件。
如果存储区中的任何目录或文件正在使用中,则存储的删除尝试将失败,并且存储将被标记为删除。 任何修改存储的后续尝试都引发 。IsolatedStorageException