wordpress文章meta,保定seo网站排名,茂名模板建站哪家好,福田网站建设多少钱Silverlight支持一种类似Cookie的独立存储,它是基于客户端的文件系统,每个Silverlight应用程序都被分配了自己的独立的存储空间. 这个存储空间在不同的操作系统下是不同的WindowsXP下 是根据账户来分配的.一般在 C:\Document and Setting\Administrator\Local Setting\Applica… Silverlight支持一种类似Cookie的独立存储,它是基于客户端的文件系统,每个Silverlight应用程序都被分配了自己的独立的存储空间. 这个存储空间在不同的操作系统下是不同的WindowsXP下 是根据账户来分配的.一般在 C:\Document and Setting\Administrator\Local Setting\Application data\Microsoft\Silverlight\is\ 我的是操作系统是win7企业版,位置在 C:\Users\Administrator\AppData\LocalLow\Microsoft\Silverlight\is\ 了解了 Isolated Storge是干嘛的 接下来来介绍下 怎么在程序中应用这个存储空间来操作目录和文件. 1,Isolated Storge 根据应用程序不同, 有应用程序和站点两种类型, 应用程序:IsolatedStorageFile.GetUserStoreForApplication(); 站点:IsolatedStorageFile.GetUserStoreForSite(); 在操作Isolated Storge 要引入using System.IO.IsolatedStorage;命名空间 2,下面就是一写代码了.大家可以复制下来看看.Go //创建目录 public void CreateDir(string dirName) { IsolatedStorageFile stoedFile IsolatedStorageFile.GetUserStoreForApplication(); stoedFile.CreateDirectory(dirName); } //列目录 public void LoadDirs() { using (IsolatedStorageFile storeFile IsolatedStorageFile.GetUserStoreForApplication()) { var itemSource storeFile.GetDirectoryNames(*); } } //删除目录 public void DeleteDir(string dirPath) { using (IsolatedStorageFile stro IsolatedStorageFile.GetUserStoreForApplication()) { stro.DeleteDirectory(dirPath); } } //创建文件 public void SaveFile(string savePath,string content) { IsolatedStorageFile storeFile IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream sf storeFile.CreateFile(savePath); using (StreamWriter sw new StreamWriter(sf)) { sw.WriteLine(content); } sf.Close(); } //读取文件 public void LoadFile(string readPath) { string content string.Empty; using (IsolatedStorageFile storeFile IsolatedStorageFile.GetUserStoreForApplication()) { if (storeFile.FileExists(readPath)) { StreamReader sr new StreamReader(storeFile.OpenFile(readPath,FileMode.Open,FileAccess.Read)); content sr.ReadToEnd(); } } } //删除文件 public void DeleteFile(string path) { using (IsolatedStorageFile storeFile IsolatedStorageFile.GetUserStoreForApplication()) { storeFile.DeleteFile(path); } } 我做了一个实例的Demo喜欢的喜欢的朋友可以下载来看看 下载地址 又一天的阳光洒满大地...转载于:https://www.cnblogs.com/xiaogangqq123/archive/2010/05/19/1739151.html