For example:
const byte defaultInput = 4;
const byte inputMin = 1;
const byte inputMax = 8;
byte input = defaultInput;
System.Console.Write("Enter value ({0}..{1}); for default value ({2}), press ENTER: ",
inputMin, inputMax, defaultInput);
string line = System.Console.ReadLine().Trim();
if (line.Length > 0) {
try {
input = byte.Parse(line);
if (input < inputMin || input > inputMax)
} catch () {
}
}
—SA