-2

Possible Duplicate:
Enums returning int value

I want to numerate "Stack", "Overflow" and "Stackoverflow". Therefore I use enumerate.

enum Status : int
{
     Stack = 1,
     Overflow = 2,
     StackOverflow = 3
}

But when I want to get value of Stack, I get "Stack".

int status = 0;
status = Status.Stack; //I want to assign 1 to status but Status.Stack returns "Stack"

How can I do it?

2
  • 1
    -1 Is it hard to google this? Commented Aug 15, 2012 at 10:48
  • yes you are right @AnatoliiG but there were a problem for :int after that it is solved.. thanks for your quick reply Commented Aug 15, 2012 at 10:53

1 Answer 1

6

Just cast to int:

status = (int) Status.Stack;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.