wp8数据存储--独立存储文件 【转】

出自 : http://www.cnblogs.com/MyBeN/p/3339019.html

文章篇幅有点大,建议去源网看看

1.调用手机的独立存储

  例如:IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication()

2.创建独立存储文件流

  例如:IsolatedStorageFileStream location = new IsolatedStorageFileStream(nateText.Text + ".item", System.IO.FileMode.Create, storage);

3.读写该文件流

  例如:将独立存储文件流转化为可写流

       System.IO.StreamWriter file = new System.IO.StreamWriter(location);

      将XML文件保存到流file上,即已经写入到手机独立存储文件上,_doc是用户创建的文件:

      _doc.Save(file);

      转化为可读流:

      System.IO.StreamReader file = new System.IO.StreamReader(location);

      解析流,转化为XML

      _xml = XElement.Parse(file.ReadToEnd());

原作者有例子,由于篇幅过大,不方便复制。

原文地址:https://www.cnblogs.com/ediszhao/p/3984000.html