Reputation: 479
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.
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.
Upvotes: 1
Views: 260