I have an enumeration that describes the options available to the user to select as part of the settings. It is serialized in XML. One of the names is not ideal, and I would like to rename it, but still support the deserialization of the old settings files.
For instance:
public enum Options { Odd, NonOdd
I know that I can rename it, but specify the previous serialized name as follows:
public enum Options { Odd, [XmlEnum(Name = "NonOdd")] Even }
While this works, he continues to use NonOdd in the XML file, which I would rather not do.
Is there a way to support deserialization of current and obsolete enumeration names, but serialized for the current name?
source share