Enumerations and Common Language Specification

When introducing enumerations, you learned that they support only numeric types. There is another limitation if you plan to implement CLS-compliant enumerations. Only CLS-compliant types can characterize CLS-compliant enumerations; therefore, the SByte, UShort, UInteger, and ULong types cannot be used within CLS-compliant enumerations. Another important consideration is that CLS-compliant enumerations must be decorated with the Flag attribute. The following is an example of a CLS-compliant enumeration:

image

Note

The Flag attribute indicates the compiler that an enumeration has to be considered as a bit ...

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.