O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

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

Determining the Types of Enumeration Elements

By default, the .NET Framework creates the elements of an enumeration internally as integer values. However, you can define whether the enumeration elements should be declared as Byte, Short, or Long. For Intel processors, you should keep in mind that Integer (32 bits in .NET) is generally preferred for performance reasons because of the alignment with an even number of memory addresses. However, regardless of the numeric size you choose, it’s sufficient to define the corresponding names for the Enum, as shown in the following:

Public Enum ContactCategory As Short
    Family
    Friend
    Acquaintance
    ...
End Enum

Retrieving the Types of Enumeration Elements at Runtime

Should you need to determine which basic data ...

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