XElement school = new XElement("school",
new XElement("SectionA",
new XElement("Student", "guna"),
new XElement("Student", "Anbu"),
new XElement("Student", "Chandru")));
XElement Student = new XElement("Student","Rajesh");
school.Save(@AppDomain.CurrentDomain.BaseDirectory + "Joiningelements.xml");
我想在学校元素中添加 SectionA 的学生元素。
答案 0 :(得分:0)
您可以像这样使用
XElement Student = new XElement("Student", "Rajesh");
school.Element("SectionA").Add(Student);