Проигнорируйте полевой порядок в DataContractSerializer

Взгляд ServiceHostFactory.

27
задан Community 23 May 2017 в 12:00
поделиться

1 ответ

No it's not optional. It's optional to explicitly specify an ordering, but otherwise the order is determined by the basic rules you linked to (base types first, alphabetic, ...).

The introductory paragraph is simply implying that you don't always need to know or care about the order - for example if you are using a generated proxy.

If you're using DataContractSerializer to deserialize a file, the best solution I can think of would be to use XSLT to transform it into the correct order before deserializing.

If you're calling a web service (what DataContractSerializer was designed for), you're better off sticking to the order in the contract.

18
ответ дан 28 November 2019 в 05:52
поделиться
Другие вопросы по тегам:

Похожие вопросы: