将数据写入文件:
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
//create new file
using (StreamWriter writeFile = new StreamWriter(new IsolatedStorageFileStream("myFile.txt", FileMode.Create, FileAccess.Write, myIsolatedStorage)))
{
string someTextData = "This is some text data to be saved in a new text file in the IsolatedStorage!";
writeFile.WriteLine(someTextData);
writeFile.Close();
}
读数据从文件:
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("myFile.txt", FileMode.Open, FileAccess.Read);
using (StreamReader reader = new StreamReader(fileStream))
{
//Visualize the text data in a TextBlock text
this.text.Text = reader.ReadLine();
}
通过这个链接:http://www.geekchamp.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files
https://www.google.co.in/#q=wp8+isolated+storage+geek
你明白了什么,当你'等待wr.WriteLineAsync( “你好”);'?我的猜测是你没有看到任何东西,因为你在编写任何东西之前关闭了你的Streamwriter。 – 2014-12-02 10:57:27
看到我的答案在这里:http://stackoverflow.com/questions/27166253/windows-phone-8-choose-text-file-c-sharp/27168118#27168118它被许多人回答了很多次。 – 2014-12-02 11:10:35
我认为你必须先谷歌它。有很多帮助。 – 2014-12-02 11:15:51