silverlight 独立存储

 //得到指定路径的数据
public static string GetRequestUrl(string Path) { IsolatedStorageFile loadfile = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream stream = loadfile.OpenFile(Path, FileMode.OpenOrCreate, FileAccess.Read); StreamReader sr = new StreamReader(stream); string Result = sr.ReadLine(); sr.Dispose(); stream.Dispose(); return Result; } //在指定路径写入数据
public static void WriteRequsetUrl(string Path,string Url) { IsolatedStorageFile loadfile = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream stream = null; stream = loadfile.CreateFile(Path); byte[] bt = System.Text.Encoding.UTF8.GetBytes(Url); stream.Write(bt,0,bt.Length ); stream.Dispose(); }

 

posted @ 2012-12-01 12:46  程序之魂  阅读(186)  评论(0编辑  收藏  举报