July 2015
Intermediate to advanced
1300 pages
87h 27m
English
As 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.
The 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 the enumerations’ items. Continuing the example of the Sports enumeration, consider the following code: