If statement in LINQ

A ternary operation requires this format

condition ? truepart : falsepart

In all of yours you are not providing that falsepart.

(Note I would have happily rewritten your code to work had you have posted it, but I’m not copying it all out from an image!)

In general though, I dont believe you need the ternary operations at all, they could simply be along the lines of

...
&& (!someCheckBox.Checked || c.SomeValue == SomeField.Value)
...

Leave a Comment