Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XmlSerializer vs DataContractSerializer

I just realized that DataContractSerializer expects nodes in the alphabetical order or the specified order. Is there any way i could make it NOT do it?

TIA

like image 913
ps. Avatar asked Mar 15 '26 15:03

ps.


2 Answers

I don't think so. You may find the discussion on this question informative:

Ignore field order in DataContractSerializer

like image 97
kbrimington Avatar answered Mar 18 '26 14:03

kbrimington


I used IDispatchMessageInspector.AfterReceiveRequest to intercept the message and sort it alphabetically.

like image 37
ps. Avatar answered Mar 18 '26 12:03

ps.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!