Cool LINQ trick

יום שני, דצמבר 22, 2008

Today I was approached with a nice question. Suppose we have a simple class with a few properties. We want to do a linq query over it with a where clause. (it doesn’t matter what is the data source, in this case it will be plain CLR objects). Let’s say that we want to construct our Where clause in such a matter that if a variable is null we ignore it and use another condition, but if it is not null we will use this one; did I confuse you? let’s try...
tags: , , ,
no comments