O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Behind the Scenes

To wrap up our discussion about enums, let’s take a quick peek behind the scenes. Even though the use of the colon syntax to specify an underlying type makes it seem like the enum type derives from the underlying type, this is not the case. All enum types derive from the System.Enum base type that’s supplied by the runtime. Each member defined on the enum turns into a constant field. An instance of the enum contains a single field holding the value that’s being used. Figure 11.11 shows what an enum definition looks like in ILDASM.

Image

FIGURE 11.11 Under the hood, an enum contains both instance and static members.

If you’re somehow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required