我有以下课程。(SIMModel、Product、Item)
public class SIMModel
{
public Product Product { get; set; }
}
public class Product
{
public List<Item> Items { get; set; }
}
public class Item
{
[XmlAttribute("ID")]
public String ID { get; set; }
[XmlAttribute("Name")]
public String Name { get; set; }
public Child_Item Child_Item { get; set; }
public Parent_Item Parent_Item { get; set; }
}
public class Child_Item
{
[XmlAttribute("ID")]
public String ID { get; set; }
}
我想制作这个 XML
<SIMModel>
<Product>
<Item ID="N" Name="N-1">
<Child_Item ID="N-1-1">
</Item>
</Proudct>
</SIMModel>
如何使用上层类制作模拟 XML?我不知道如何包装每个类..