Enumerations and the 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. The following is an example of a CLS-compliant enumeration:
<Flags()> Public Enum ClsCompliantEnum As Byte FirstValue = 0 SecondValue = 1 ThirdValue = 2End Enum
Note
In CLS-compliant enumerations, decorating an Enum
with the Flag
attribute indicates to the compiler that the enumeration has to be considered as a set of bit ...
Get Visual Basic 2015 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.