Friday, 20 December 2019

C# Enumeration


An enumeration is used in C# programming language to define a constant set of values. Example, the days of the week can be defined as an enumeration and used anywhere in the program. In C#, the enumeration is defined with the help of the 'enum' keyword



Example:

class Program 
 {
  enum Days{Sun,Mon,tue,Wed,thu,Fri,Sat};
  
  static void Main(string[] args) 
  {
   Console.Write(Days.Sun);
   
   Console.ReadKey();
  }
 }




Output: Sun

Share this


0 Comments

Advertisement