unity3d editor - How to check unknown number of booleans c# -


i need check unknown number of booleans.. depending on result appropriate function. here example of i'm searching:

if(bool[x] && bool[y] && bool[z] ...)    myfunc(); 

you can use linq that.

if need bools true, can use any:

if (bools.all(b => b)) 

if need, example, 4 of them true, can use count:

if (bools.count(b => b) == 4) 

or @ least one, there's any

if (bools.any(b => b)) 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -