This is a solution, assuming you meant ==, not =:
var query = from d in database
where (x == y ? d.Attr == x : d.Attr == y)
select d;
However, this is logically equal to the following:
var query = from d in database
where d.Attr == y
select d;
Because, if x == ytrue, then d.Attr == xthey d.Attr == y will be equal.
source
share