Enumeration:
You can create your own set of named constants by using enumerations. In enumeration can be defined by using the
enum keyword.
The default underlying type of the enumeration elements is int. By default, the first enumerator has the value 0, and the value of each successive enumerator is increased by 1.
Ex:
using System;
public class EnumSamp
{
enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};
static void Main()
{
int a = (int)Days.Sun;
int b = (int)Days.Fri;
Console.WriteLine("Mon = {0}", a);
Console.WriteLine("Wed= {0}", b);
}
}
Saran
Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator