Enum String Name from Value
You can convert the int
back to an enumeration member with a simple cast, and then call ToString()
:
int value = GetValueFromDb();
var enumDisplayStatus = (EnumDisplayStatus)value;
string stringValue = enumDisplayStatus.ToString();
If you need to get a string "Visible"
without getting EnumDisplayStatus
instance you can do this:
int dbValue = GetDBValue();
string stringValue = Enum.GetName(typeof(EnumDisplayStatus), dbValue);
Try this:
string m = Enum.GetName(typeof(MyEnumClass), value);