private static NumberReader SetBoundariesToReader() { var boundaryReader = new NumberReader(int.MinValue, int.MaxValue); Console.Write("Define min allowed number: "); int min = boundaryReader.ReadNumberFromConsole(); Console.Write("Max allowed number: "); int max = boundaryReader.ReadNumberFromConsole(); while (min + NumLoops >= max) { Console.WriteLine("\nMax number should be greater than {0}. Try again.", min + NumLoops); Console.Write("\nMax allowed number: "); max = boundaryReader.ReadNumberFromConsole(); } return new NumberReader(min, max, NumLoops); }
private static NumberReader SetBoundariesToReader() { var boundaryReader = new NumberReader(int.MinValue, int.MaxValue); Console.Write("Define min allowed number: "); int min = boundaryReader.ReadNumberFromConsole(); Console.Write("Max allowed number: "); int max = boundaryReader.ReadNumberFromConsole(); while (min + NumLoops >= max) { Console.WriteLine("\nMax number should be greater than {0}. Try again.", min + NumLoops); Console.Write("\nMax allowed number: "); max = boundaryReader.ReadNumberFromConsole(); } return(new NumberReader(min, max, NumLoops)); }