Test if an object is an Enum
Solution 1:
The question is the answer. :)
bool isEnum = theObject is Enum;
Solution 2:
If you have a Type
, use the Type.IsEnum
property, e.g.:
bool isEnum = theObject.GetType().IsEnum;
Solution 3:
just use
if (theObject is Enum)
//is an enum