初见 IsolatedStorage

 IsolatedStorage 翻译过来是(隔离存储空间)

怎么理解呢,jake lin的故事讲得很好,可以拿过来借用一下

"

朝鲜人民精神文明都非常的发达,

因此上网时都不需要访问internet.

因此不可能访问我们的网络.也不能访问其他精神文明没有他们发达的国家的网络.

我们也不能访问朝鲜的网络.其他精神文明不够发达的国家也不能访问他们的网络.

所以朝鲜网络是完完全全隔离于internet.

所以朝鲜人民的网络就类似于Isolated Storage.

"

所有的文件IO操作被限制在隔离存储空间里面.
1.隔离存储空间里面可以增删改 目录和文件.
2.隔离存储空间里面可以存储程序配置信息.


IsolatedStorageFile 用于操控隔离存储空间里面的目录和文件

IsolatedStorageFileStream用于读写操控隔离存储空间里面的文件流

IsolatedStorageSettings用于存储程序配置信息Dictionary

IsolatedStorage逻辑上的空间,不是物理上的空间.

 

引用

using System.IO.IsolatedStorage;
using System.IO;

 

新增目录

using ( IsolatedStorage file = IsolatedStorageFile.GetUserStoreForApplication())
{
file.CreateDirectory(FolderName);
}



检查目录是否存在

using ( IsolatedStorage file = IsolatedStorageFile.GetUserStoreForApplication())
{
if(file.DirectoryExists(FolderName))
{
//FolderName已经存在
}
   else
{
//FolderName不存在
}
}



删除目录

using ( IsolatedStorage file = IsolatedStorageFile.GetUserStoreForApplication())
{
file.DeleteDirectory(FolerName);
}



posted @ 2012-03-22 23:07  wordy_wangL  阅读(273)  评论(0编辑  收藏  举报