int[] collection = new int[] { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 }; string result; foreach(int number in collection) { if (number % 2 == 0) // even (or zero) result = "it's even!"; else result = "that's odd..."; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)