ForAll3
TTests if all corresponding elements of the collection satisfy the given predicate
.
If any application returns false
then the overall result is false
and no further elements are tested. Otherwise, true is returned.
WARNING
This function causes
IEnumerable<T>
evaluation.
Parameters
Returns
Func<T, T2, T3, bool> predicate
IEnumerable<T> source
IEnumerable<T2> source2
IEnumerable<T3> source3
bool
Usage
Checking if all elements of all collections are equals
//IEnumerable<int> source = { 4, 2, 6, 8, 10 }
//IEnumerable<int> source2 = { 4, 2 }
//IEnumerable<int> source3 = { 4, 2 }
bool result =
source.ForAll3(
source2,
source3,
(element1, element2,element3) => element1 == element2
&& element2 == element3);
//result = true
//IEnumerable<int> source = { 4, 2, 6, 8, 10 }
//IEnumerable<int> source2 = { 4, 2, 5 }
//IEnumerable<int> source3 = { 4, 2, 5 }
bool result =
source.ForAll3(
source2,
source3,
(element1, element2,element3) => element1 == element2
&& element2 == element3);
//result = false
Last updated
Was this helpful?