我有一個孤立的存儲問題。在IsolatedStorageFileStream上不允許操作。錯誤
這是我的代碼:
List<Notes> data = new List<Notes>();
using (IsolatedStorageFile isoStore =
IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream isoStream =
isoStore.OpenFile("Notes.xml", FileMode.OpenOrCreate))
{
XmlSerializer serializer = new XmlSerializer(typeof(List<Notes>));
data = (List<Notes>)serializer.Deserialize(isoStream);
}
}
data.Add(new Notes() { Note = "hai", DT = "Friday" });
return data;
錯誤:操作不IsolatedStorageFileStream不允許的。在
using (IsolatedStorageFileStream isoStream =
isoStore.OpenFile("Notes.xml", FileMode.OpenOrCreate))
這個答案也適用於windows phone 8。謝謝。 –