当前位置: 代码迷 >> Windows Mobile >> Windows Phone读写文件的有关问题
  详细解决方案

Windows Phone读写文件的有关问题

热度:91   发布时间:2016-04-25 07:43:56.0
Windows Phone读写文件的问题
在这样的情况下,输入名字+号码,点击储存,将刚才输入的内容使用Isolated Storage存储到文件中。再次输入再次保存时,会将原来存储内容覆盖,现在只能保存一条记录。这是为什么?
wm中可以移动指针去接着存储,wp中应该怎么办?

添加记录的代码:
  IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();
  myStore.CreateDirectory("ContactList");
  using (var isoFileStream = new IsolatedStorageFileStream("ContactList\\contact.txt", FileMode.OpenOrCreate, myStore))
  {
  //Write the data
  using (var isoFileWriter = new StreamWriter(isoFileStream))
  {
  isoFileWriter.Write(TB_Name.Text + ": " + TB_Phone.Text);
  }
  }

求高人帮助解答?

------解决方案--------------------
OpenOrCreate->Append
------解决方案--------------------
FileMode.OpenOrCreate 这个参数导致的,你看看FileMode都有哪些情况就明白了
------解决方案--------------------
应该是向文件里追加才对
------解决方案--------------------
探讨

先读出原文件所有内容···然后再追加一起存进去
  相关解决方案