The easiest way is to use [XmlEnum] attribute like so:
[Serializable]public enum EnumToSerialize { [XmlEnum("1")] One = 1, [XmlEnum("2")] Two = 2 }
This will serialize into XML (say that the parent class is CustomClass) like so:
2
本文共 250 字,大约阅读时间需要 1 分钟。
The easiest way is to use [XmlEnum] attribute like so:
[Serializable]public enum EnumToSerialize { [XmlEnum("1")] One = 1, [XmlEnum("2")] Two = 2 }
This will serialize into XML (say that the parent class is CustomClass) like so:
2
转载地址:http://lsttl.baihongyu.com/