Founded that:
typeof(System.Enum).IsClass == false
It's become strange that System.Enum
has also .IsValueType == false
, but Reflector shows that it is really just an abstract class
.
System.Enum
is a reference type like a System.ValueType
and casting enumeration values to/from System.Enum
reference caused boxing/unboxing. No surprises here.
But what is a reason for Type
class not to tell truth about System.Enum
nature?
There is no anything extraordinary with the System.Enum
type's reflection behavior to make it looks like not a reference type.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…