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
總結
以上是生活随笔為你收集整理的wp8数据存储--独立存储文件 【转】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: javascript入门视频第一天 小案
- 下一篇: UVa 1225 Digit Count