The enum keyword is used to declare an enumeration. An enumeration is a set of named constants. It is a primitive data type, which is user-defined. 

Things to remember

  • An enumerator cannot contain white space in its name.
  • It is best to define an enum directly within a namespace so that all classes in the namespace can access it.
  • By default, the first member of an enum has the value 0 and the value of each successive enum member is increased by 1.


using System;   //Adding namespaces
namespace LearnCSharp //Namespace of the class
class Program //The class
enum Days
Sunday = 1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
enum Month
January, February, March, April, May, June
static void Main(string[] args) //Main method
Console.WriteLine("Day of week {0} {1}", (int)Days.Sunday, Days.Sunday);
Console.WriteLine("Day of week {0} {1}", (int)Days.Monday, Days.Monday);
Console.WriteLine("Day of week {0} {1}", (int)Days.Tuesday, Days.Tuesday);

Console.WriteLine("Month of year {0} {1}", (int)Month.January, Month.January);
Console.WriteLine("Month of year {0} {1}", (int)Month.February, Month.February);
Console.WriteLine("Month of year {0} {1}", (int)Month.March, Month.March);



Day of week 1 Sunday
Day of week 2 Monday
Day of week 3 Tuesday
Month of year 0 January
Month of year 1 February
Month of year 2 March