MAIN MENU
Enumerators in C#
Enumerators provide a way to improve code readability by representing values as names. So for instance, we may have a set of categories of Diary, Veg and Fruit which we could represent as 0,1 and 2. A better way is to use an enumerator as follows :
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("{0} ", Produce.Diary);
}
}
public enum Produce
{
None,Diary,Veg,Fruit
}
}