Getting enumerate value

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?


只需转换为int:

status = (int) Status.Stack;
链接地址: http://www.djcxy.com/p/91788.html

上一篇: 如何从EventLogEntryType枚举中获取int值

下一篇: 获得枚举值