public void Choice(out int result) { Console.WriteLine("Enter your choice:"); try { result = Convert.ToInt32(Console.ReadLine()); if (result >= 6 || result < 0) { throw new FormatException(); } else { Todo(result); } } catch (FormatException) { result = 0; Console.Clear(); Console.WriteLine("Incorrect input, choose only from 1 to 5."); Parking.UI(); this.Choice(out result); } }
Stack <int> outside = new Stack <int>(); //Stacks for vehicles outside the parking slot public void EnhanceOperation() { int result = 5; Parking.UI(); this.Choice(out result); this.Todo(result); }