[XmlIgnore] public string GuestRemarks { get; set; } [XmlElement("GuestRemarks")] public XmlNode[] Nodes { get { var dom = new XmlDocument(); return new XmlNode[] {dom.CreateCDataSection(this.GuestRemarks)}; } set { if (value == null) { this.Gue…
使用XmlSerializer可以方便的将对象序列化为xml,实现应用之间的数据交互.但是XmlSerializer却不能很好地序列化类型中的可空字段. 例如,有如下定义的类Person: [Serializable] [XmlRoot(ElementName = "Person")] public class Person { public string FirstName { get; set; } public string LastName { get; set; } publ…
using System; using System.IO; using System.Xml.Serialization; namespace XStream { /// <summary> /// <remarks>Xml序列化与反序列化</remarks> /// <creator>zhangdapeng</creator> /// </summary> public class XmlSerializeUtil { #regi…