3

What is the default value of a nullable enum (Nullable<enum> / enum?)?

public enum Days
{
    Sun,
    Mon,
    Tue,
    Wed,
    Thu,
    Fri,
    Sat,
};

What will default(Days?) evaluate to?

Intentionel duplicate of What is the default value of the nullable type β€œint?” (including question mark)?. If you don't know that nullable integer (int?) acts the same as nullable enum (enum?), you do not know that the question is the same, and therefore do not read the question nor its answers.

Jogge
  • 1,654
  • 12
  • 36
  • If you need evidence to be satisfied, see [here](http://rextester.com/BSBYL27302). Also, take a read of the [`nullable` source code](https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/nullable.cs) – ProgrammingLlama Mar 14 '18 at 09:21
  • 2
    Default value of any Nullable<> is null – Cristian E. Mar 14 '18 at 09:21

0 Answers0