BDInfo.runner.getIntIndex C# (CSharp) Метод

getIntIndex() статический приватный Метод

static private getIntIndex ( int min, int max ) : int
min int
max int
Результат int
        static int getIntIndex(int min, int max)
        {
            String response;
            int resp = -1;
            do
            {
                while (Console.KeyAvailable)
                    Console.ReadKey();

                Console.Write("Select: ");
                response = Console.ReadLine();
                //Console.WriteLine();

                try
                {
                    resp = int.Parse(response);
                }
                catch (Exception)
                {
                    Console.WriteLine("Invalid Input! ");
                }

                if (resp > max || resp < min)
                {
                    System.Console.WriteLine("Invalid Selection!");
                }
            } while (resp > max || resp < min);

            System.Console.WriteLine();

            return resp;
        }