保存到文件 - > Windows Phone

时间:2013-12-03 22:19:14

标签: c# xml windows-phone

我有问题。我创建了一个代码,但我不知道为什么这个程序什么都不保存。所有时间文件“phone.xml”看起来都一样。为什么?

XDocument xDoc = XDocument.Load("contacts_class/phone.xml");
XElement xEle = Load();
xEle.Add(new XElement("Contact",
    new XElement("FirstName", name),
    new XElement("LastName", surname),
    new XElement("PhoneNumber", number)));
var file = IsolatedStorageFile.GetUserStoreForApplication();
using (var stream = new IsolatedStorageFileStream("phone.xml", FileMode.OpenOrCreate, file))
{
    xDoc.Save(stream);
}

///

1 个答案:

答案 0 :(得分:1)

您从未更改xDoc

修改不相关的变量不会影响xDoc