IsolatedStorageFile.GetUserStoreForApplication 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取与调用代码的应用程序标识对应的用户范围的独立存储。
public:
static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetUserStoreForApplication();
C#
public static System.IO.IsolatedStorage.IsolatedStorageFile GetUserStoreForApplication();
static member GetUserStoreForApplication : unit -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetUserStoreForApplication () As IsolatedStorageFile
与基于调用代码的程序集标识的独立存储范围对应的对象。
未授予使用独立存储的足够权限。
使用此方法时,与应用程序关联的所有程序集都使用相同的独立存储。 仅当可以确定应用程序标识时(例如,通过 ClickOnce 部署发布应用程序或基于 Silverlight 的应用程序)时,才能使用此方法。 如果尝试在基于 ClickOnce 或 Silverlight 的应用程序外部使用此方法,将收到异常 IsolatedStorageException ,因为无法确定调用方的应用程序标识。
GetUserStoreForApplication 在功能上等效于以下代码:
isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application |
IsolatedStorageScope::User, (Type^)nullptr);
C#
isoFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.Application |
IsolatedStorageScope.User, null);
isoFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.Application Or _
IsolatedStorageScope.User, Nothing)
在此代码中 applicationIdentity
, 的 GetStore(IsolatedStorageScope scope, Object applicationIdentity)
参数为 null
。
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |