How to check for unknown number of booleans C #
5 answers
Something like that:
var all=true;
for (var i=x; i<z; i++) if (!bool[i]) {all=false; break;}
if (all) myFunc()
or, if x, y, z
not sequential, put them in a list or array:
int[] indices = new [] {x, y, z};
and then repeat like this:
var all=true;
foreach (var i in indices) if (!bool[i]) {all=false; break;}
if (all) myFunc()
0
source to share