Tuesday, February 6, 2018

DataContract fields can change to strings without problems

Recently I needed to expand a DataContract-serialized field to hold arbitrary strings, not just integers, optimally without breaking existing serialized objects. Looking at the XML shows that there isn't anything identifying a field as necessarily being any specific simple type. Changing the class definition of the serialized type to have a field be a string instead of something more structured works fine in terms of loading old data.

No comments:

Post a Comment