string userTypeId = ((int)ERPSystemUserType.Basic).ToString();
public enum ERPSystemUserType
{
Basic = 20,
Upgraded = 30
}
if I use ToString()
, return the enum type's string value, however I want to use the defined int
value.
如果我使用ToString(),返回枚举类型的字符串值,但是我想使用定义的int值。
Is there any attribute or way, I could use for return string by is number of the enum? Instead of doing ((int)ERPSystemUserType.Basic).ToString()
. And don't want to use the Extension, then I have to use to every enum.
是否有任何属性或方式,我可以用于返回字符串是枚举的数字?而不是做((int)ERPSystemUserType.Basic).ToString()。并且不想使用Extension,那么我必须使用每个枚举。