Example #1
0
        public static int InputIndexValidation()

        {
            int value;

            while (!int.TryParse(Console.ReadLine(), out value) || value < 0)
            {
                Console.WriteLine("Please enter a valid positive number");
            }

            if (value < EmployeeJournal.GetEmployees().Length)
            {
                EmployeeJournal.RemoveAt(value);
                Console.WriteLine($"The employee on index {value} was succesffully removed from the list");
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("There is no such employee");
            }

            return(value);
        }