- private void button1_Click(object sender, RoutedEventArgs e)
- {
- List<Student> students = new List<Student>();<span style="white-space:pre"> </span>//实例化实体类
- students.Add(new Student() { sno = "1", sname = "张三" }); //给实体赋值
- students.Add(new Student() { sno = "2", sname = "李四" });
- students.Add(new Student() { sno = "3", sname = "王五" });
- IsolatedStorageSettings.ApplicationSettings["Stu"] = students; //将实体类赋给键值为Stu 的ApplicationSettings
- IsolatedStorageSettings.ApplicationSettings.Save(); //保存对象
- }
- private void button2_Click(object sender, RoutedEventArgs e)
- {
- List<Student> students = new List<Student>(); //实例化实体类
- students = IsolatedStorageSettings.ApplicationSettings["Stu"] as List<Student>; 将键值为Stu的Applications赋给实体
- }
IsolatedStorageSettings.ApplicationSettings
最新推荐文章于 2020-03-18 10:30:45 发布