Any easier way to write this if statement
if (value1 <= 0 || value2 <= 0)
For example some think like if ((value1 || value2) <= 0
Any easier way to write this if statement
if (value1 <= 0 || value2 <= 0)
For example some think like if ((value1 || value2) <= 0
No, your way is correct. If you have more than two values and you want to know if any of them is less than or equal to zero use an array
if(new [] { value1, value2, value3, ... }.Any(x => x <= 0))
in this case :
if (value1 <= 0 || value2 <= 0)
if value1 <=0
is true
then it will short circut the evaluation and directly go inside the if loop as
1 || 0 = 1
1 || 1 = 1