8,494
社区成员




ComputerEntity entity = tree.CurrentBaseEntity as ComputerEntity;
XElement groupElement = new XElement("Group", new XAttribute("Name", entity.GroupName));
XElement carsElement = new XElement("Cars", new XAttribute("Name", entity.CollectionName));
XElement carElement = new XElement("Car",
new XAttribute("Id", entity.Id),
new XAttribute("Width", entity.Width),
new XAttribute("Height", entity.Height),
new XAttribute("IsSelected", entity.IsSelected.ToString()),
new XAttribute("CollectionName", entity.CollectionName),
new XAttribute("GroupName", entity.GroupName),
new XElement("Name", entity.Name),
new XElement("IP", entity.IP),
new XElement("X", entity.X),
new XElement("Y", entity.Y)
);
carsElement.Add(carElement);
groupElement.Add(carsElement);
this.xmlDoc.Add(groupElement);
生成xml文件
然后保存:XElement.Save(路径)