Use of Enums in C#

Sourav.Kayal
Posted by Sourav.Kayal under C# category on | Points: 40 | Views : 901
using System;
using System.Text;
namespace Test1
{

enum Employee
{
HR,
Developer,
Designer
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter your choice");
string Choice =Convert.ToString(Console.ReadLine());
if(Choice.Equals(Convert.ToString(Employee.HR)))
{
Console.WriteLine("You choose HR");
}
else if (Choice.Equals(Convert.ToString(Employee.Developer)))
{
Console.WriteLine("You choose Developer");
}
else if (Choice.Equals(Convert.ToString(Employee.Designer)))
{
Console.WriteLine("You choose Designer");
}

Console.ReadLine();

}
}
}

Comments or Responses

Login to post response