Anyone knows the default value for enums using the default keywords as in:
MyEnum myEnum = default(MyEnum);
Would it be the first item?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is the value produced by
(myEnum)0. For example:Then
default(myEnum)would bemyEnum.baror the first member of the enum with value 0 if there is more than one member with value 0.The value is
0if no member of the enum is assigned (explicitly or implicitly) the value 0.