Below is a sample code snippet that demonstrates how to declare , define and access the Enumeration in C#.
Example of Enumeration in C#
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace AbundantcodeConsoleApp
{
enum EmployeeDesignation
{
Trainee,
SoftwareEngineer,
SeniorSoftwareEngineer
};
internal class Program
{
private static void Main(string[] args)
{
EmployeeDesignation design = EmployeeDesignation.SoftwareEngineer;
Console.ReadLine();
}
}
}
Leave a Reply