我必須在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文本「文件它沒有創建」。我不知道爲什麼應用程序找不到我的文件。