我必须在Windows Phone 7.1的移动应用程序中读取文本文件。我写我的代码:在WP7中读取文件
IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication();
StreamReader Reader = null;
try
{
Reader = new StreamReader(new IsolatedStorageFileStream("folder\\file.txt", FileMode.Open, fileStorage));
string textFile = Reader.ReadToEnd();
textBlock.Text = textFile;
Reader.Close();
}
catch
{
MessageBox.Show("File it not created");
}
所有的时候,当我试着读这个文件,应用程序显示我的MessageBox文本“文件它没有创建”。我不知道为什么应用程序找不到我的文件。