Home > DeveloperSection > Forums > How to use Enum in c# .net.
Ankit Singh

Total Post:341

Points:2389
Posted on    November-23-2015 9:44 PM

 .NET C#  .NET 
Ratings:


 1 Reply(s)
 299  View(s)
Rate this:
I want to use Enum in c# please help me


aditya kumar Patel

Total Post:250

Points:1782
Posted on    November-23-2015 9:56 PM

An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword.
C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.

using System;
namespace Forum
{
    public class Enum
    {
        enum Month { January, February, March, April, May, June, July, August, September, October, November, December };
        static void Main(string[] args)
        {
            Month value = Month.January;
            if (value == Month.January)
            {
                Console.WriteLine("This Month is January.");
            }
            Console.ReadLine();
        }
    }

}


Don't want to miss updates? Please click the below button!

Follow MindStick