c# - How to return true if one of 4 bools is true -


i trying realise method, returns true, if 1 of several bools true.

bool = false; bool b = false; bool c = true; bool d = false;  private bool oneofthem() {    return && b && c && d; } 

this doesn't work. how make work?

use or (||) instead of && operator.......

|| operator (c# reference) - msdn

the conditional-or operator (||) performs logical-or of bool operands. if first operand evaluates true, second operand isn't evaluated. if first operand evaluates false, second operator determines whether or expression whole evaluates true or false.


Comments

Popular posts from this blog

objective c - Can't build GCM with Protobuf in Xcode -

ember.js - EmberJS Model find not up-to-date with underlying store -

embed HTML within ASP.net -