Enumerations

Enumerations are another kind of value types available in the .NET Framework. They represent a group of constants enclosed within an Enum..End Enum code block. An enumeration derives from System.Enum, which derives from System.ValueType. The following is an example of enumeration:

image

By default, enumerations are sets of integer values. The preceding code defines a Sports enumeration of type Integer, which stores a set of integer constants. The Visual Basic compiler can also automatically assign an integer value to each member within an enumeration, starting from zero as indicated in comments. You can eventually manually assign custom ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.