How can you get the underlying/derived Type(byte, short, int, etc) of an enum?
You are looking for Enum.GetUnderlyingType(enumType);
Enum.GetUnderlyingType(enumType)
Sample from MSDN:
static object GetAsUnderlyingType(Enum enval) { Type entype = enval.GetType(); Type undertype = Enum.GetUnderlyingType(entype); return Convert.ChangeType(enval, undertype); }
2.1m questions
2.1m answers
60 comments
57.0k users