S.Hale 3920b7c4ce Corrected capitalization, corrected to American spellings and typos (#30685)
* Translate challenge subtitles and example challenge text to Spanish

* Corrected errors in syntax and punctuation

* Multiple corrections of it/s to its plus other grammar corrections

* Correction and added paragraph to CSS Flex article

* Corrected my own typo

* Corrected capitalization, American spellings and typos
2018-11-07 10:34:13 -05:00

47 lines
887 B
Markdown

---
title: Enumerations
---
# Enumerations
An enumeration is a set of named integer constants that is declared using the `enum` keyword.
## Example
```
enum Gender
{
Male,
Female
}
```
By default, the integer values start at 0 and increase by 1, for each enumeration name i.e. Male = 0, Female = 1 etc.
These can be overridden by specifying an integer value for any of the enumeration names.
## Example
```
enum Gender
{
Male = 1,
Female
}
```
In this case, the integer values will start at 1 and increase from there.
To use an enum, you can declare a variable of its type and assign a value to it:
`Gender myVar = Gender.Male;`
You can also cast an enumeration name value to its underlying integer value and vice versa:
```
Console.WriteLine($"Male: {(int)Gender.Male}");
Console.WriteLine($"Female: {(int)Gender.Female}");
```
## Output:
```
Male: 1
Female: 2
```