Monday, May 27, 2013

int arry check for all odd or even??

All returns a Boolean result so you could use it in an if statement.



if (Test.All(i => (i % 2) == 0) || Test.All(i => (i % 2) > 0))
{
//all odd or even so do stuff
}
else
{
//mixed so do stuff
}


No comments:

Post a Comment