2011-05-08 22 views

回答

2

你会希望将持久性项目存储到IsolatedStorage中。您可以看到如何使用IsolatedStorage here的概述和示例。 this site上还有一系列示例,显示如何保存不同类型的对象。

1

下面是存储字符串的示例,但您应该能够以这种方式存储任何类型的对象。 添加IsolatedStorage您参考:

using System.IO.IsolatedStorage; 

在你的类:

private string myString; 

在Loaded事件对你的页面:

try 
{ 
    myString = (string)IsolatedStorageSettings.ApplicationSettings["myString"]; 
} 
catch 
{ 
    IsolatedStorageSettings.ApplicationSettings.Add("myString", "this value is a string"); 
} 

后来,当你想保存:

IsolatedStorageSettings.ApplicationSettings["myString"] = myString; 
0

在 之后尝试上面的示例代码来添加此项。 IsolatedStorageSettings.ApplicationSettings.save

相关问题