Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のxmlノードがあります
<group> <level id="1" name="Level 1" /> <level id="2" name="Level 2" /> </group>
属性を持つ新しい要素をxmlファイルに挿入する方法
var doc = XDocument.Load("yourxmlfile.xml"); var x = new XElement("level", new XAttribute("id", 3), new XAttribute("name", "Level 3")); doc.Element("group").Add(x); doc.Save("yourxmlfile.xml");