I have a C# class that is serialized to disk by the BinaryFormatter, such as this example:
// Version 3.0
[Serializable]
public class Person
{
public string FullName;
[OptionalField(VersionAdded=2)]
public string NickName;
[OptionalField(VersionAdded=2)]
public DateTime BirthDate;
[OptionalField(VersionAdded=3)]
public int Weight;
}
Later, I want to refactor this class by one or more of the following
- Change its name
- Change its namespace
- Move to another assembly
As far as I can tell, the binary file can only be de-serialized if a class with the exact same name, namespace and assembly name is available.
How do I work around this?
Is it possible to map the de-serialization to a different class name, namespace and assembly without breaking Version Tolerant Serialization?