Adding OR expressions in a loop in Linq

Viewed 7569

I have a variable number of OR conditions that I want to put together into one Linq query.

How do I do this in a loop? Basically, the final query is to be:

IQueryable<MyObject> Q;
Q = Q.Where(q => (condition1) || (condition2) || ..... || (condition N));

Something like:

For (int i = 0; i < someNumber; i++) {
  Q = Q.Where(q => (existing conditions) || (q.Value == i)); 
}

What statement can I use to replace (existing condition) in example above without having the final expression (Q) have nested Q's inside them?

Thanks.

3 Answers
Related