Anyone knows the default value for enums using the default keywords as in:
MyEnum myEnum = default(MyEnum);
Would it be the first item?
It is the value produced by (myEnum)0. For example:
enum myEnum
{
  foo = 100
  bar = 0,
  quux = 1
}
Then default(myEnum) would be myEnum.bar or the first member of the enum with value 0 if there is more than one member with value 0.
The value is 0 if no member of the enum is assigned (explicitly or implicitly) the value 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With