Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on an issue where we have a class (with tag Serializable) that we need to serialize into XML. We cannot viably set the order on every property because to do so would be a huge refractor. It's writing things out of order from how we expect it in the schema after recent changes. The schema validation blows up when we deserialize it because it's out of order. Is there a way to either set the order in the class without using the serialization order tags (the properties already appear in the order we wanted), or make it so the schema can handle things being out of order without changing the XML version (using sequence for the elements, and it's xml 1.0)?

What I have tried:

setting order on each property (not practical - too many classes inherit, complete refractor) and ignoring deserialization errors (doesn't fix root problem)
Posted
Updated 13-May-20 21:12pm
Comments
Maciej Los 14-May-20 3:12am    
Seems, you need to provide versioning. See: Version tolerant serialization | Microsoft Docs[^]

1 solution

All what you need is called: Version tolerant serialization | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900