dotvariant
dotvariant copied to clipboard
Skip emptiness handling if type cannot be empty
If a variant class
has no default constructor and all other constructors initialize the _variant
field to a non-default value then the variant cannot be empty. Under these circumstances the "empty" case is impossible to achieve and can be removed from the interface as these code paths will never execute.
Possible conflict: if constructors are later changed and the empty state becomes possible the previously safe methods could now throw InvalidOperationException
. Maybe keeping the empty state is the safer option as it reminds the user of this eventuality. This needs investigating.