use &&
(logical and) not &
(binary operator)
like:
p1() && p2();
it will return true only if all p*()
are true (same as &
), but note that if first p*()
will return false rest of expression won't be evaluated. In case of &
whole expression will be evaluated
var functions = new List<Func<bool>>();
functions.Add(p1);
functions.Add(p2);
functions.Add(p3);
functions.Add(p4);
functions.Add(p5);
functions.Add(p6);
functions.Add(p7);
return functions.Take(idcount).All(x=>x());
try above it looks cleaner than switch statement and should examine if all first idcount
entries are true same as switch case with &&