Any extension for IEnumerable<T> and IQueryable<T> that returns itself can be called with If appended to it and be conditionally applied. Here is a sample for applying where clauses conditionally ...