LINQ All Operator - Sequence - Test All Elements Satisfy Condition
By Indranil Chatterjee
The LINQ All operator allows to test if all elements of a sequence satisfy a condition.
The following code sample demonstrates how:
int[] numbers = {2, 4, 6, 8};
bool allEven = numbers.All(n => n % 2 == 0); // this returns true for the given
array but false for {2,3,6,8}
LINQ All Operator - Sequence - Test All Elements Satisfy Condition (747 Views)