I know that if I bind the operators &&or ||together in the same operator, C # stops calculating the operator and returns the corresponding result if it evaluates the expression and no matter what the following expressions, the result will not change. For instance:
var result = false && foo() && bar();
In this expression, foo()they bar()will never be executed, since the first expression is false. My question is, will it Enumerable.Aggregate<TSource, TAccumulate>do the same when running through the bools list, or will it evaluate all expressions independently? For instance:
var result = new List<bool>
{
false,
foo(),
bar()
}.Aggregate(true, (acc, x) => acc && x);
source
share