How can I make a linq search that ignores nulls (or nullables)?
I have a method
IEnumerable<X> Search(int? a, int? b, int? c)
And I want it to return matches on any of the ints? that are not null.
IE: if a
and c
have values 1 and 9 and b
is null the search should render (roughly) to
SELECT *
FROM [TABLE]
WHERE a = 1
AND c = 9
My real method will have 5+ paramters, so iterating combinations is right out.