Hi...
I want to know, what is default value of enum in .net ? Please tell me anyone ?
Thanks....
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jan 11, 2012, 6:59 AM
vyar throtPosted Jul 14, 2014, 1:42 AM
enum Tempurature
{
Low = 2,
Medium,
High,
};
The value of Medium is 3
Source: http://csharp.net-informations.com/statements/enum.htm
Vyar
Vineet Kumar SainiPosted Jan 11, 2012, 11:07 PM
Pravin MorePosted Jan 11, 2012, 7:03 AM
default value for any enum is zero(0)
Ankit ShivnakrPosted Jan 11, 2012, 6:57 AM
default, the first enumerator has the value 0, and the value of each successive enumerator is increased by 1.
Satyapriya NayakPosted Jan 11, 2012, 6:46 AM
Integers in the C# programming language are always initialized to zero when they are fields of a class. When you have an enum field, it will also be initialized to zero. To make enums valid, always use the default value of zero
Please refer the below link
http://www.dotnetperls.com/enum
Thanks