この構造のxmlファイルを作成したい:
<Devices>
<Device Number="58" Name="Default Device" >
<Functions>
<Function Number="1" Name="Default func" />
<Function Number="2" Name="Default func2" />
<Function Number="..." Name="...." />
</Functions>
</Device>
</Devices>
これが私のコードです:
document.Element("Devices").Add(
new XElement("Device",
new XAttribute("Number", ID),
new XAttribute("Name", Name),
new XElement("Functions")));
各オブジェクト「デバイス」には「関数」のリスト<>がありますが、xmlに「関数」を追加するにはどうすればよいですか?