How do I determine if a Nullable(of Enum)
is indeed an Enum
by means of reflection?
I'm working with a method that dynamically populates an object of type T
with an IDataReader
retrieved from a database call. At its essence, it loops through the datareader's ordinals, and all the properties of T
and populates the properties that match the name of the ordinals (also some attribute magic is thrown to change column names). In every other circumstance, it works great, but when I check the property's BaseType
for System.Enum
I find instead, System.ValueType
Thusly, my Enum check fails and the method bombs.
[Edit:
Type.IsEnum
doesn't work how I need it. The main issue here, is that nothing in T
's BaseType hierarchy says that it is an Enum
. It's as if making it a Nullable
type forfeits my Enum
rights.]
Any ideas?