May 2010
Intermediate to advanced
1272 pages
61h 18m
English
System.EnumAs mentioned at the beginning of this section, all enumerations derive from the System.Enum class. Such a type exposes some shared methods that enable performing operations on enumerations. This subsection explains how you can take advantage of methods for working on enumerations.
GetValues and GetNamesThe first two methods described are GetValues and GetNames. Both enable retrieving an array of items stored within an enumeration, but GetValues gets an array of integers corresponding to the numeric values of enumerations’ items whereas GetNames retrieves an array of strings storing the names of enumerations’ items. Continuing the example of the Sports enumeration, consider the following code:
This code’s output ...
Read now
Unlock full access