I've been using the following code block to ask user for input and checking its validity in a console application.
do
{
Console.Write("Enter X value:"); // prompt
} while (!(int.TryParse(Console.ReadLine(),out temp) && (temp<=10) && (temp>=0))); // repeat if input couldn't be parsed as an integer or out of range
Is it a documented feature that the "&&" (and) expression evaluating is lazy? ie: if first operand is false then it wouldn't parse the second operand? Can I rely on it in production builds? Can I expect that it would behave the same in other compilers?
This is something I picked up in PPCG.SE
Additionally, can the block be made simpler to read or simplified into a oneliner?