switch using enum c# code example
Example: enum switch menu c#
enum Menu
{
Students_Detail = 1,
Display = 2,
Exit = 3
}
static void Main(string[] args)
{
Console.WriteLine("Please select a menu option");
Console.WriteLine("1. Students Detail");
Console.WriteLine("2. Display");
Console.WriteLine("3. Exit");
int pick = Convert.ToInt32(Console.ReadLine());
Menu menuChoice = new Menu();
menuChoice = (Menu)pick;
switch (pick)
{
case 1:
break;
case 2:
break;
case 3:
break;
default:
break;
}
}