独立存储区是位于硬盘上的一个分区。可以确保让其他应用程序无法查看你的文件.
using System.IO.IsolatedStorage;
IsolatedStorageFile isoStore=IsolatedStorageFile.GetStore(IsolatedStorageScope.Assembly|IsolatedStorageScope.User,null,null);
string fn=isoStore.GetFileNames(“a.txt“);
if(fn==null)
{
StreamWriter sw=new StreamWriter(IsolatedStorageFileStream(“a.txt“),FileMode.CreateNew,isoStore);
sw.write(“hello“);
}
else
{
StreamReader sr=IsolatedStorageFileStream(“a.txt“),FileMode.Open,isoStore);
string s=sr.ReadLine();
}
using System.IO.IsolatedStorage;
IsolatedStorageFile isoStore=IsolatedStorageFile.GetStore(IsolatedStorageScope.Assembly|IsolatedStorageScope.User,null,null);
string fn=isoStore.GetFileNames(“a.txt“);
if(fn==null)
{
StreamWriter sw=new StreamWriter(IsolatedStorageFileStream(“a.txt“),FileMode.CreateNew,isoStore);
sw.write(“hello“);
}
else
{
StreamReader sr=IsolatedStorageFileStream(“a.txt“),FileMode.Open,isoStore);
string s=sr.ReadLine();
}