WP7 Isolated Storage Text Document Read Line
Is there a way using Isolated storage ie a Text document, to grab the text on a certain line. I would like to save variables to a te开发者_开发知识库xt document on my settings page of my app. Then go back to the main page and read the variable saved on line 3. I already know how to save them. just not read certain lines.
Also is the text document created by my app going to still be there if i close and reopen the app?
Try this
using( TextReader reader = new StreamReader( 
         new IsolatedStorageFileStream( "myFile.txt", System.IO.FileMode.Open, 
           IsolatedStorageFile.GetUserStoreForApplication() ) ) {
    string line = reader.ReadLine(); // first line, discard
    line = reader.ReadLine();        // second line, discard
    line = reader.ReadLine();        // third line, read the variable value
}
However, you might be better off using the IsolatedStorageSettings class to store settings (the link contains example usage). Another option is to put all your settings into a serializable class and use an XmlSerializer to save / read the settings. Both these approaches would not require parsing the file manually.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论