HOW TO USE ENUM IN C# .NET.

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
C#  .NET 
 549  View(s)
Ratings:
Rate this:
I want to use Enum in c# please help me
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to use Enum in c# .net.

    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();
            }
        }

    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!