Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is ENUM?

Answer Posted / srinivasan

Enum is a type for which the memory will be allocated on the stack instead of the heap. It can be used to write presentable code in place where we will be using integers. For Ex.

Enum Declaration

private Enum OperationalResult
{
Success = 1,
Failure = 2
}

Enum Usage

Switch (result)
{
case: (int)OperationalResult.Success
MessageBox.Show("Yippe,Operation Success");
break;
case: (int)OperationalResult.Failure
MessageBox.Show("OOPS! It's a failure");
break;
default:
MessageBox.Show("OOPS! Canno determine");
break;
}

Here in the above code, if the following statement
(int)OperationalResult.Success is replaced with 1, it does not make sense and a new developer looking at the wouldn't understand what 1 represents.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is xml tags are case sensitive?

831


What is using keyword?

866


Explain the difference between a Private Assembly and a Shared Assembly

905


Explain About multi level and multiple inheritance how to achieve in .net

979


What are examples of desktop applications?

900


Why singleton pattern is used in c#?

905


Can var be null c#?

811


Name the control which cannot be placed in mdi?

838


What are the different ways of method can be overloaded?

820


Illustrate race condition?

842


How do I declare a pure virtual function in c#?

919


If you donot specify an access modifier for a method, what is the default access modifier?

969


How to implement singleton design pattern in c#?

832


Define property in c#.net?

905


Explain what a diffgram, and a good use for one Define diffgram? How it be used?

947