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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -