Q:

(de)serialization of changed objects in C#

I'm using C#, .NET Framework 4.0.
I have class which consists of two strings and few int fields.
In my program I serialize/deserialize objects of that class, and everything works fine, but in future this class will need to be changed multiple times, by adding new int fields. How can I make old saved data compatible with new objects of same class, for example I need to do an for loop through all objects of that class, including old ones which don't have new int fields set?

A:

I'd use Json for that. That way when you add new properties to your class you won't need to change any of the load / save code. I usually use json.net for that.

