If I have a class with an enum
member and I want to be able to represent situations where this member is not defined, which is it better?
a) Declare the member as nullable in the class using nullable types. E.g.:
public SomeEnum? myEnum;
b) Add a default, 'unknown' value to the enumeration. E.g.:
public enum SomeEnum {
Unknown,
SomeValueA,
SomeValueB,
SomeValueC,
}
I can't really see any major pros/cons either way; but perhaps one is preferable over the other?