Enumerations in C#.NET

Enumerations in C#.NET

Enum type is useful for storing the values. By using this, programmer can do his job very easier. Especially, this is useful for storing constant values globally or locally. we can call this constants as magic constants. This is distinct datatype which declares some named constants.

Example: Sunday, Monday, Tuesday, .... etc.

Example Program: 
In this program we have list of weekDays having named constants. for the below program "http://aspnettutorialonline.blogspot.com/" will come as output.

    class Program
        enum weekdDays
        static void Main(string[] args)
            weekdDays today=weekdDays.Saturday;

            if (today == weekdDays.Monday)
                Console.WriteLine("not fired");
            if (today == weekdDays.Saturday)


See more OOPS DOTNET Interview Questions

See more ASP.NET, C#.NET, SQL Server and more Interview Questions

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar