Windows Phone的本地存储——IsolatedStorageFile
来源:互联网 发布:fc2最新视频域名 编辑:程序博客网 时间:2024/06/05 09:43
本篇我们来了解如何通过IsolatedStorageFile来实现信息的本地存储。使用IsolatedStorageFile和使用System.IO.File和System.IO.Directory进行文件访问非常类似,再此仅仅列出对于文本文件的写入跟读取。
通过IsolatedStorageFile写入文件:
private void WriteData() { IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); store.CreateDirectory("StoreFileTemp"); using (IsolatedStorageFileStream storeStream = new IsolatedStorageFileStream("StoreFileTemp\\Test.txt", FileMode.OpenOrCreate, store)) { using (StreamWriter sw = new StreamWriter(storeStream)) { sw.WriteLine(txtWrite.Text); } } }
通过IsolatedStorageFile读取文件:
private void ReadData() { IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); if (store.FileExists("StoreFileTemp\\Test.txt")) { using (IsolatedStorageFileStream storeStream = new IsolatedStorageFileStream("StoreFileTemp\\Test.txt", FileMode.Open, store)) { using (StreamReader sr = new StreamReader(storeStream)) { tbRead.Text = sr.ReadLine(); } } } }
- Windows Phone的本地存储——IsolatedStorageFile
- 独立存储, windows phone IsolatedStorageFile
- Windows Phone 独立存储之IsolatedStorageFile
- Windows Phone 7的本地存储——IsolatedStorageSettings
- Windows Phone的本地存储——IsolatedStorageSettings
- Windows phone IsolatedStorageFile 读写XML
- 08,Windows Phone 本地存储
- Windows phone 7中,把页面数据存为长期存储(非IsolatedStorageFile),而是用IsolatedStorageSettings
- Windows Phone——本地数据库
- Windows Phone Mango编程实践——本地数据库
- Windows Phone 7独立存储之本地数据库
- Windows Phone 7 开发——独立存储
- Windows Phone 的数据存储方式总结
- Windows Phone 的数据存储方式总结
- Windows Phone 独立存储
- windows phone:独立存储
- Windows Phone读取本地数据
- windows phone:使用本地数据库
- C#、sql时间的计算
- 两个javascript对象与实例详解
- 黑马程序员--数据库概述,表,主外键,以及常用基本数据类型
- 软件模拟gpio 实现
- 数据库的联合查询及服务器时间登陆错误时间的间隔
- Windows Phone的本地存储——IsolatedStorageFile
- 深入浅出REST
- javascript函数
- 用户登陆限时,错误登陆次数不超过3次(winForm)
- hadoop的安全模式
- 网页特效,链接本页显示
- application的另一些属性
- vmware 上网
- 起跑第一步——我的软件生涯