繁体   English   中英

Windows 电话 7,IsolatedStorageSettings “Remove()”不工作,一个错误?

[英]Windows Phone 7, IsolatedStorageSettings “Remove()” not working, a bug?

我在我的 Windows Phone 7 项目中使用IsolatedStorageSettings class 作为键值存储来记住我的应用程序中的用户首选项和登录凭据。

问题是,当我使用密钥调用Remove(string)方法,然后我使用Save()方法来持久化更改时。 Remove()方法返回true ,这意味着值被删除。 但是当我下次尝试获取该值时,我看到它仍然存在并且没有被删除。

这是我用于删除的代码:

if (isolatedStore.Contains(key))
{
    isolatedStore[key] = null;
}

bool del = isolatedStore.Remove(key);
isolatedStore.Save();

以下是我如何获取isolatedStorage实例:

private IsolatedStorageSettings isolatedStore =
     IsolatedStorageSettings.ApplicationSettings;

你认为问题出在哪里?

我在以下链接中找到了这个块。 不过,我没有尝试按照您的方式删除密钥。 http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/17514c94-1f59-47b4-bb78-99694bfbb6b2

public static void DeleteObject(string key)
{
  IsolatedStorageSettings.ApplicationSettings.Remove(key);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM