<分区>
Possible Duplicate:
Get Enum from Description attribute
大家好, 我有这样定义的枚举。
public enum SomeType {
[Description("One Value")]
One,
[Description("Two Value")]
Two,
[Description("Three Value")]
Three
}
但是当我尝试像这样解析一个字符串时
SomeType test = (SomeType )Enum.Parse(typeof(SomeType ), "Three Value");
我收到异常消息“未找到请求的值‘三值’”。这不是应该工作吗?
谢谢