Build your hideCompleted
as a true one, similar to this approach:
var query = dc.SomeTable; if (hideCompleted) { query = query.Where(t1 => !t1.IsCompleted); }
That way, when hideCompleted
true, you filter t1.IsCompleted
to false. If hideCompleted
false, your original query will capture all results regardless of the value of t1.IsCompleted
.
source share