What is the correct syntax for lambda expression for a bool value comparrison?
The example below shows rsp.InputOutput which is a bool value. However I get a compiler error when I try to do this. I know its something small, any help appreciated.
In this examplem I want to select all rulesetparameters which have an InputOutput value of true.
validRuleSetParameters.SelectMany(rsp => rsp.InputOutput == true)
thanks
Niall
I think you’re just looking for the
Whereclause:SelectManyis quite different; it is used when you want to project each member of a sequence to another sequence, and then flatten the resulting sequence-of-sequences into a single sequence.Do note that if
InputOutputis a boolean property,rsp.InputOutputis already a boolean-expression. Consequently, using the equality operator to produce another boolean expression (by comparing its value with the literal booltrue) is unnecessary.