Suppose I had this class:
[Serializable]
public class SomeClass
{
public SomeClass() {//init}
public string SomeString {get;set;}
}
This class gets Serialized when the application closes, and gets deserialized on the next run.
Then, I built it and released the application, and now the class has changed:
[Serializable]
public class SomeClass
{
public SomeClass() {//init}
public string SomeString {get;set;}
public int SomeInt {get;set;}
}
Is there a way to set a property to its default on deserialization in case its not found in the old serialized object?
One way I thought about is keeping the old version of the class, then check the version that was serialized then looping properties of the old object and setting them in the new object, but this is non sense to me, any other solution that makes sense?
BinaryFormatter
– Mehalick