枚举确实序列化为整数.但通常,如果您不喜欢将某个属性序列化为XML的方式,则可以执行以下操作:
[XmlIgnore] public MyThing MyThing { get; set; } [XmlElement("MyThing")] [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public string MyThingForSerialization { get { return //convert MyThing to string; } set { MyThing = //convert string to MyThing; } }