Using XmlSerializer with private and public const properties

前端 未结 6 2085
渐次进展
渐次进展 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 09:09

    It doesn't make sense to consider const members, as they aren't per-instance; but if you just mean non-public instance members: consider DataContractSerializer (.NET 3.0) - this is similar to XmlSerializer, but can serialize non-public properties (although it is "opt in").

    See here for more.

提交回复
热议问题