0
    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");

ここでは、school要素にSectionAの学生要素の子を追加します。

4

1 に答える 1

0

このように使用できます

XElement Student = new XElement("Student", "Rajesh");

school.Element("SectionA").Add(Student);
于 2012-08-09T11:43:00.410 に答える