我已尝试将数据保存到文件但我收到了以下错误
第Operation not permitted on IsolatedStorageFileStream
行<{1}}
IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(path, FileMode.OpenOrCreate, storage);
答案 0 :(得分:2)
试试这个:
public void SaveFile(string path, string data)
{
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (var fileStream = new IsolatedStorageFileStream(path + fileName, FileMode.Create, FileAccess.Write, storage))
{
using (StreamWriter writer = new StreamWriter(fileStream))
{
writer.WriteLine(data);
writer.Close();
}
fileStream.Close();
}
}
}