8,497
社区成员
发帖
与我相关
我的任务
分享
string xmlFileName = System.IO.Path.Combine(Environment.CurrentDirectory, @"Data\Data.xml");
XDocument xDoc = XDocument.Load(xmlFileName);
xDoc.Root.Add(new XElement("Dish",
new XElement("Name", dish.Name),
new XElement("Category", dish.Category),
new XElement("Comment", dish.Comment),
new XElement("Score", dish.Score)));
xDoc.Save("Data\\Data.xml", SaveOptions.None);