이 클래스는 IsolatedStorageFile 격리된 스토리지 파일을 삭제하는 두 가지 메서드를 제공합니다.
인스턴스 메서드 Remove() 는 인수를 사용하지 않고 이를 호출하는 저장소를 삭제합니다. 이 작업에는 권한이 필요하지 않습니다. 저장소에 액세스할 수 있는 모든 코드는 저장소 내의 데이터를 모두 삭제할 수 있습니다.
정적 메서드 Remove(IsolatedStorageScope) 는 열거형 값을 사용하고 User 코드를 실행하는 사용자의 모든 저장소를 삭제합니다. 이 작업에는 IsolatedStorageFilePermission 값에 대한 AdministerIsolatedStorageByUser 권한이 필요합니다.
예시
다음 코드 예제에서는 정적 및 인스턴스 Remove 메서드의 사용을 보여 줍니다. 클래스는 두 개의 저장소를 가져옵니다. 하나는 사용자 및 어셈블리에 대해 격리되고 다른 하나는 사용자, 도메인 및 어셈블리에 대해 격리됩니다. 그러면 격리된 스토리지 파일Remove()의 메서드를 isoStore1
호출하여 사용자, 도메인 및 어셈블리 저장소가 삭제됩니다. 그런 다음, 정적 메서드 Remove(IsolatedStorageScope)를 호출하여 사용자의 나머지 모든 저장소가 삭제됩니다.
using System;
using System.IO.IsolatedStorage;
public class DeletingStores
{
public static void Main()
{
// Get a new isolated store for this user, domain, and assembly.
// Put the store into an IsolatedStorageFile object.
IsolatedStorageFile isoStore1 = IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, null, null);
Console.WriteLine("A store isolated by user, assembly, and domain has been obtained.");
// Get a new isolated store for user and assembly.
// Put that store into a different IsolatedStorageFile object.
IsolatedStorageFile isoStore2 = IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
IsolatedStorageScope.Assembly, null, null);
Console.WriteLine("A store isolated by user and assembly has been obtained.");
// The Remove method deletes a specific store, in this case the
// isoStore1 file.
isoStore1.Remove();
Console.WriteLine("The user, domain, and assembly isolated store has been deleted.");
// This static method deletes all the isolated stores for this user.
IsolatedStorageFile.Remove(IsolatedStorageScope.User);
Console.WriteLine("All isolated stores for this user have been deleted.");
} // End of Main.
}
Imports System.IO.IsolatedStorage
Public Class DeletingStores
Public Shared Sub Main()
' Get a new isolated store for this user, domain, and assembly.
' Put the store into an IsolatedStorageFile object.
Dim isoStore1 As IsolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User Or
IsolatedStorageScope.Domain Or IsolatedStorageScope.Assembly, Nothing, Nothing)
Console.WriteLine("A store isolated by user, assembly, and domain has been obtained.")
' Get a new isolated store for user and assembly.
' Put that store into a different IsolatedStorageFile object.
Dim isoStore2 As IsolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User Or
IsolatedStorageScope.Assembly, Nothing, Nothing)
Console.WriteLine("A store isolated by user and assembly has been obtained.")
' The Remove method deletes a specific store, in this case the
' isoStore1 file.
isoStore1.Remove()
Console.WriteLine("The user, domain, and assembly isolated store has been deleted.")
' This static method deletes all the isolated stores for this user.
IsolatedStorageFile.Remove(IsolatedStorageScope.User)
Console.WriteLine("All isolated stores for this user have been deleted.")
End Sub
End Class
참고하십시오
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET