xml序列化一起指定xmlelement和xmlattribute
鉴于: –
[XmlRoot("Book")] public class Book { [XmlAttribute] public string Title; [XmlElement] public string Publisher; [XmlElement] public string PublisherReference; }
当序列化为XML时会给出
Some Publisher XYZ123
我如何将PublisherReference作为Publisher的属性 – 例如
上述就是C#学习教程:xml序列化一起指定xmlelement和xmlattribute分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
Some Publisher
[XmlRoot("Book")] public class Book { [XmlAttribute] public string Title; [XmlElement] public Publisher Publisher; } [Serializable] public class Publisher { [XmlText] public string Value; [XmlAttribute] public string Reference; }
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/1033596.html