-2
我想且具"Stack"
,"Overflow"
和"Stackoverflow"
。因此我使用枚舉。
enum Status : int
{
Stack = 1,
Overflow = 2,
StackOverflow = 3
}
但是,當我想要得到堆棧的價值,我得到"Stack"
。
int status = 0;
status = Status.Stack; //I want to assign 1 to status but Status.Stack returns "Stack"
我該怎麼辦?
-1是很難[谷歌](https://www.google.com/search?q=get+numeric+vslue+from+enum&rlz=1C1SKPL_enUA453UA453&sugexp =鉻,MOD = 14&的SourceID =鉻&即= UTF-8#HL = UK&pwst = 1&RLZ = 1C1SKPL_enUA453UA453&sclient = PSY-AB&q = C%23 +獲取+從+枚舉和OQ = C%23 +得到+數字+值+從+數字+值+枚舉&gs_l = serp.3..0i30.110038.111035.0.111516.3.3.0.0.0.0.124.322.1j2.3.0 ... 0.0 ... 1c.BAs9Fmuc_xg&PBX = 1&BAV = on.2,or.r_gc.r_pw.r_cp。 r_qf。&fp = 13173b19efa8ab06&biw = 1920&bih = 967)這個? – 2012-08-15 10:48:44
是的,你是對的@AnatoliiG,但有一個問題:int後,它解決了..感謝您的快速回復 – 2012-08-15 10:53:28