Is enum type derived from Enum struct?

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

Hi,

I found an enum type, for example:
enum Alignment
{
Top,
Bottom
}

is derived Enum, but Enum is a struct. However,
struct isn't be inherited. Could you explain it
for me?
 
[Serializable]
public struct Enum : IComparable, IFormattable, IConvertible
Name: System.Enum
Assembly: mscorlib, Version=1.0.5000.0
 
Hi Jerry,

Enum is a defined set of contants - a collection of related contants. They
are not like struts, though they are value types. System.Enum is simply a
class reprsentation of enum types.

HTH,
Rakesh Rajan
 
is derived Enum, but Enum is a struct. However,
struct isn't be inherited. Could you explain it
for me?

Enum is actually a class, unlike everything else that derives from
ValueType. It's handled specially by the runtime in that sense.



Mattias
 
Back
Top