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(); }

 

你可能感兴趣的:(silverlight)