C# Enums: Nullable or ‘Unknown’ Value?

Definitely use a nullable value type – that’s what they’re for. It explicitly states your intention. It also means you can use Enum.IsDefined (or the equivalent from Unconstrained Melody if you want generic type safety) to easily determine whether a particular value is a real value without worrying about the “fake” one too.

Leave a Comment