The purpose of Nullable<T>
is to provide an additional null
(or empty) value on top of its underlying value.
Enums that define a None
or Empty
value (as their default) have a well
defined empty/null state. Creating models with those types as nullables is
inconvenient as the check .HasValue
still does not tell if the value is not
empty.
SomeClass
{
public MyENum? Value { get; }
}
SomeRecord(MyENum? Value);
enum MyENum
{
None = 0,
}
SomeClass
{
public MyENum Value { get; }
}
SomeRecord(MyENum Value);
enum MyENum
{
None = 0,
}