使用windows phone 8缓存的最佳方法是什么?

本文关键字:最佳 方法 是什么 缓存 windows phone 使用 | 更新日期: 2023-09-27 17:50:52

我正在制作windows phone sdk 8中的应用程序,我想知道最好的方法是存储本地数据。我想用它来存储数据和优化内存使用。有人能帮我一下吗?

使用windows phone 8缓存的最佳方法是什么?

如果你想存储字符串,那么你可以使用isolatedstoragessettings

基本上,将数据放入WP7 IsolatedStorage的最简单方法是使用isolatedstoragessettings类,该类是一个字典,将键值对存储在隔离存储中。

样本存储与检索

//storage
IsolatedStorageSettings.ApplicationSettings["State"] = your string;
 IsolatedStorageSettings.ApplicationSettings.Save();
//retrieval
 if (IsolatedStorageSettings.ApplicationSettings.Contains("State") == true)
 {
 var object= IsolatedStorageSettings.ApplicationSettings["State"] as string;
 //Remove the state now
 IsolatedStorageSettings.ApplicationSettings.Remove("State");
 IsolatedStorageSettings.ApplicationSettings.Save();
 }

还有,点击这个链接