static void DeleteEmployee(EmployeeArray employees) { Employee emp = GetEmployeeInfo(); if (employees.Contains(emp)) { Console.WriteLine("Deleting employee"); employees.Remove(emp); } else { Console.WriteLine("There is no such employee"); } }
static void Main(string[] args) { EmployeeArray empArray = new EmployeeArray(); int proceed = 1; while (proceed != 0) { Console.WriteLine("\n\n* * MENU DRIVEN * *\n\n1.Insert Information\n2.Delete Information\n3.Display Information\n press any other number to exit\n"); Console.Write("Enter Choice:\t"); int ch = Convert.ToInt32(Console.ReadLine()); switch (ch) { case 1: Employee emp = Createworker(); empArray.Add(emp); break; case 2: DeleteEmployee(empArray); break; case 3: foreach (Employee e in empArray) { Console.WriteLine(e); } empArray.PrintEmp(); break; default: Console.Write("Invalid Choice"); break; } Console.WriteLine("press 0 to exit else anyother number to continue : "); proceed = Convert.ToInt32(Console.ReadLine()); } }