【问题标题】:More than one instance of IsolatedStorageSettings?多个独立存储设置实例?
【发布时间】:2014-05-08 20:18:08
【问题描述】:

我正在寻找使用 C# 在 Win Phone 8 中存储数据的方法。

首先,是否可以创建多个IsolatedStorageSettings 实例?

例如,下面的代码是否相当于两组单独的设置:

IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
IsolatedStorageSettings settings2 = IsolatedStorageSettings.ApplicationSettings;

其次,我查看了 IsolatedStorageFiles,但在下面的代码中出现错误。可能是我使用的示例跳过了一些步骤。

IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);

错误:

  • “System.IO.IsolatedStorage.IsolatedStorageFile”不包含 'GetStore' 的定义
  • 当前上下文中不存在名称“IsolatedStorageScope”
  • 当前上下文中不存在名称“IsolatedStorageScope”

【问题讨论】:

    标签: c# windows-phone-8 isolatedstorage application-settings isolatedstoragefile


    【解决方案1】:

    查看 MSDN IsolatedStorageSettings.ApplicationSettings Property 上的这篇文章,因为它清楚地说明了

    获取一个IsolatedStorageSettings 的实例,该实例包含应用程序的IsolatedStorageFile 的内容,范围在应用程序级别,如果不存在,则创建一个新的IsolatedStorageSettings 实例。

    因此无法创建多个IsolatedStorageSettings 的实例。

    对于IsolatedStorageFiles,msdn 页面上有一个非常全面的示例来处理它。 IsolatedStorageFile Class

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多