C# Enumerations (Enums) – Definition, Example, and Usage
C# Enumerations
Enumerations, or enums, let you define a fixed set of named constants in C#. They’re ideal for representing discrete values such as days of the week, months, or status codes.
Below we walk through a simple, real‑world example that shows how to declare an enum, assign values, and use it in your code.

using System;
namespace DemoApplication
{
class Program
{
enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }
static void Main(string[] args)
{
Console.WriteLine(Days.Sun);
Console.ReadKey();
}
}
}
Code Breakdown
- Enum declaration:
enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }creates a new type namedDayswith seven named values. - Usage:
Console.WriteLine(Days.Sun);prints the enum value to the console.
If you run this program, you’ll see the following output:
Output

The console displays Sun, confirming that the enum value is correctly referenced.
C Language
- C++ For Loops Explained: Syntax, Workflow, and Practical Examples
- Mastering std::stack in C++: A Comprehensive Guide with Practical Examples
- C++ Structs Explained with a Practical Example
- C++ Classes & Objects: A Practical Guide with Code Examples
- C++ Polymorphism Explained: Practical Examples & Key Concepts
- Mastering std::list in C++: Syntax, Functions & Practical Examples
- Mastering C# Variables & Operators: Practical Examples & Explanations
- Understanding C# Interfaces: Definition, Example, and Practical Use
- C# Windows Forms Development: A Hands‑On Tutorial
- Understanding C# Enumerations (Enums) – A Comprehensive Guide