How to get the enumeration text instead of value in C#?

Raja
Posted by Raja under C# category on | Views : 4859
To get the enumeration text instead of its value, write following code

For example

public enum EnumType
{
Type1,
Type2
}


If you write EnumType.Type1 its value will be treated as 1 but if you want to get the Type1 then write following code.

string enumValue = EnumType.Type1.ToString();


Thanks

Comments or Responses

Login to post response