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

What is the difference between abstract and abstraction?

832


What do you mean by a windows process in regards to memory allocation?

945


What are the collection types can be used in c#?

864


What are the properties of a string class?

992


Name some properties of thread class.

985


What is boxing? Explain its functionality?

953


What is the difference between double and decimal in c#?

950


What is the difference between == and object.equals?

966


What is the namespcae generally given to the webpage of the .NET Framework ?

1043


What is a satellite assembly in c#?

986


What is ilasm.exe used for?

901


Is exe is machine dependent?

914


What are the different types of classes in c#?

932


how to sort an array in c#

986


What is final keyword in c#?

978