Using XmlSerializer with private and public const properties

前端 未结 6 2075
渐次进展
渐次进展 2020-12-19 08:07

What\'s the simplest way to get XmlSerializer to also serialize private and \"public const\" properties of a class or struct? Right not all it will output for me is things

6条回答
  •  清酒与你
    2020-12-19 08:52

    XmlSerializer only looks at public fields and properties. If you need more control, you can implement IXmlSerializable and serialize whatever you would like. Of course, serializing a constant doesn't make much sense since you can't deserialize to a constant.

提交回复
热议问题