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); }
1.4m articles
1.4m replys
5 comments
57.0k users