How avoid exception deserializing an invalid enum item?
问题 For simplicity purposes here, I will show my sample code using fruit. In actuality I am doing something more meaningful (we hope). Let say we have an enum: public enum FruitType { Apple, Orange, Banana } And a class: [Serializable] public class Fruit { public FruitType FruitType { get; set; } public Fruit(FruitType type) { this.FruitType = type; } } We can serialize and de-serialize it. Now, lets revise the enum, so that it is now: public enum FruitType { GreenApple, RedApple, Orange, Banana