c# - checking if a number is even but not zero, in 1 condition? -


i don't think possible can done in 1 condition instead of 2?

i'm trying not this

bool test = (number1 & 1) == 0 && (number1 > 0); 

or this

bool test = (number1 & 1) == 0 && (number1 != 0); 

will return true numbers >= 2 , false odd numbers, numbers <= 0:

bool test = ((number1 - 1) % 2 == 1); 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -