C# enum

tutorial and example
tutorial and example

Enum in C# is also known as enumerations. It basically refers to a named set of constants such as months, days, seasons, etc.

Enum improves type safety. They contain fixed set of constants and they can be traversed. We can define Enum outside or within the class or structs.

Let’s see a simple example of enum in C#.

C# Enum Example:

Output

C# Enum Example: Traversing all values

Output