Using Enumerated Types Types defined using the Enum keyword are implicitly derived from ValueType just as structures are. Enumerated types provide a convenient notation for defining a list of values semantically associated to a named value. As demonstrated earlier, for example, you could use an enumeration EyeColor to constrain valid values for eye colors to realistic colors. In contrast, if you used the Color type, you might end up with indications that someone has mauve or cyan-colored eyes. Table 5.1 lists the shared members of System.Enum types and provides a brief description for each. You will see these capabilities used where it's appropriate to do so, throughout this book. Table 5.1. System.Enum Members
Table 5.1 introduces the public members of enumerated types, not including the members introduced from the ancestor type Object. The public members defined in every classinherited from the Object classwere shown in Table 2.1 in Chapter 2. |
Team-Fly |
Top |