0
不能更具体地说出标题的道歉,但我只能通过举例来解释。XML序列化结构
我试图建立一个序列化下面的XML类
<Customize>
<Content></Content>
<Content></Content>
<!-- i.e. a list of Content -->
<Command></Command>
<Command></Command>
<Command></Command>
<!-- i.e. a list of Command -->
</Customize>
我的C#是:
[XmlRoot]
public Customize Customize { get; set; }
和
public class Customize
{
public List<Content> Content { get; set; }
public List<Command> Command { get; set; }
}
然而,这产生(如它应该),如下:
<Customize>
<Content>
<Content></Content>
<Content></Content>
</Content>
<Command>
<Command></Command>
<Command></Command>
<Command></Command>
</Command>
</Customize>
是否有一些xml序列化属性可以帮助实现我所需的xml,还是我必须找到另一种写入类的方法?
您可以添加序列化代码? – Styxxy