In C# language, enum is the data type.
Enum is defined according to-
- enum Month {Jan,Feb,March,April}
- //To Access the Enum we do by the following way :-
- Console.WriteLine("The Value of Enum is {0}",Month.Jan);
- ///OutPut You got as : The Value of Enum is Jan
Do You Know
- Even though, you are assigning the names to the enum member list; the compiler actually assigns an integer value to the member of the list starting with zero(0) and increment each for the successive members.
- If you want to know about assigning integer value of particular enum member in the list, you need to type cast it to the integer, using Convert.Toint32() method.
For eg :- Finding integer value.- Console.WriteLine(Convert.toInt32(Month.Jan));
Output: 0 - You can also give the custom enum list value programmatically.For Example
- enum Month {Jan=2,Feb=3,March=5};
- Console.writeline(Convert.toInt32(Month.Jan));
Output: 2. - By default, the compiler initializes int value to the list of Enum starting form zero(0). We can make change in the data type of enum as well through programmatically, changing default data type of enum form int to byte type.
- enum Month:byte {Jan=2,Feb=3,March=5};
- Console.writeline(sizeof(Month));
Output: 1 ///Try it by replacing byte to int and you get output as 4.

Satish Kumar VadlavalliPosted Nov 9, 2016, 4:55 AM
Good information Surya, dig more into subject
Amatya AgyeyPosted Nov 9, 2016, 12:03 AM
You can Explore more on various dataTypes. Best Of Luck
Sachin KumarPosted Oct 12, 2016, 2:58 AM
Simple and Easy.
Sinraj VPosted Sep 19, 2016, 5:08 AM
Good one...
Surya KantPosted Sep 17, 2016, 11:22 AM
Thanks.
Manav PandyaPosted Sep 17, 2016, 10:13 AM
Nice Share sir ...
SubashPosted Sep 15, 2016, 12:16 AM
Nice one
Bhuvan PandeyPosted Sep 13, 2016, 7:34 AM
Good