IsolatedStorageFile.GetUserStoreForApplication 方法

定義

取得對應於呼叫程式碼的應用程式識別之使用者範圍隔離儲存區。

public:
 static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetUserStoreForApplication();
public static System.IO.IsolatedStorage.IsolatedStorageFile GetUserStoreForApplication ();
static member GetUserStoreForApplication : unit -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetUserStoreForApplication () As IsolatedStorageFile

傳回

物件,該物件對應至以呼叫程式碼的組件識別為基礎的隔離儲存區範圍。

例外狀況

尚未授與足夠的隔離儲存區使用權限。

無法初始化隔離的儲存區位置。

-或-

無法判斷呼叫端的應用程式識別,因為 ActivationContext 屬性傳回 null

-或-

無法判斷應用程式定義域的使用權限。

備註

使用此方法時,與應用程式相關聯的所有元件都會使用相同的隔離存放區。 只有在可以判斷應用程式身分識別時,才能使用這個方法,例如,當應用程式透過 ClickOnce 部署發佈或以 Silverlight 為基礎的應用程式時。 如果您嘗試在 ClickOnce 或 Silverlight 型應用程式之外使用這個方法,您將會收到 IsolatedStorageException 例外狀況,因為無法判斷呼叫端的應用程式身分識別。

GetUserStoreForApplication 在功能上相當於下列程式代碼:

isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application |
    IsolatedStorageScope::User, (Type^)nullptr);
isoFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.Application |
    IsolatedStorageScope.User, null);
isoFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.Application Or _
    IsolatedStorageScope.User, Nothing)

在這裡代碼中,參 applicationIdentityGetStore(IsolatedStorageScope scope, Object applicationIdentity) 數為 null

適用於

另請參閱