Creating and Using Enums

C Sharp > Creating and Using Enums
20.10.2016 16:35:17


Наиболее часто встречающиеся слова в статье:

[variables] [•Create] [possible] [Tuesday] [Wednesday] [instance] [favoriteDay] [equivalent]


Статья:

Creating and Using Enums

•Create variables with a fixed set of possible values

enum Day { Sunday, Monday, Tuesday, Wednesday, ... };

•    Set instance to the member you want to use

Day favoriteDay = Day.Friday;

•    Set enum variables by name or by value

Day day1 = Day.Friday;

// is equivalent to 

Day day1 = (Day) 4;