Using XmlSerializer with private and public const properties

前端 未结 6 2076
渐次进展
渐次进展 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条回答
  •  猫巷女王i
    2020-12-19 08:52

    Here's my solution to putting immutable values in a property that will serialize to XML:

    [XmlElement]
    public string format { get { return "Acme Order Detail XML v3.4.5"; } set { } }
    

提交回复
热议问题