3

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

2 Answers 2

4

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

Ignore field order in DataContractSerializer

Sign up to request clarification or add additional context in comments.

Comments

3

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

1 Comment

This is a good idea. In my case, my serialized object inherits from another serialized object. So the tags for the base class come first (in alphabetical) and then the tags for the derived class (in alphabetical order). So, sorting doesn't quite work for that kind of situation.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.