I want to remove one enum value from my enum. But when deserializing JSON if that removed enum value found then it should select my choice of enum value instead of defaulting to None
which is first value in my enum for backward compatibility.
Example:
public enum ExampleHotkeyType
{
None,
CaptureRegion,
CaptureRegionWindow,
CaptureRegionPolygon,
CaptureRegionFreehand
}
I want to remove CaptureRegionWindow
in this enum and when deserializing if CaptureRegionWindow
found I want it to be assigned to CaptureRegion
instead. That way it won't default to None
.
I searched maybe I could set CaptureRegion
enum value to have more than one name as attribute but couldn't find such thing.
What would be best way to handle this issue so my users setting won't reset?
Note: I'm using StringEnumConverter when serializing/deserializing.