Redigera

Dela via


IsolatedStorageFile.GetUserStoreForApplication Method

Definition

Obtains user-scoped isolated storage corresponding to the calling code's application identity.

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

Returns

An object corresponding to the isolated storage scope based on the calling code's assembly identity.

Exceptions

Sufficient isolated storage permissions have not been granted.

An isolated storage location cannot be initialized.

-or-

The application identity of the caller cannot be determined, because the ActivationContext property returned null.

-or-

The permissions for the application domain cannot be determined.

Remarks

All assemblies associated with an application use the same isolated store when using this method. This method can be used only when the application identity can be determined - for example, when the application is published through ClickOnce deployment or is a Silverlight-based application. If you attempt to use this method outside a ClickOnce or Silverlight-based application, you will receive an IsolatedStorageException exception, because the application identity of the caller cannot be determined.

GetUserStoreForApplication is functionally equivalent to the following code:

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)

In this code, the applicationIdentity parameter for GetStore(IsolatedStorageScope scope, Object applicationIdentity) is null.

Applies to

See also