 <p>Have you tried to add a ToList() statement to the where statement?</p> <pre><code>query = query.Where(x =&gt; x.GetType() == typeof(T)).ToList(); </code></pre> <p>As I recall the result of the Where statement is a too generic collection and therefore it needs to be cast first.</p> <p>Since I see that you're using an AddRange, it could also need to be converted to an array, use the ToArray() statement instead of the ToList() statement if the first doesn't work. I'm not sure if you can provide a List to an AddRange() statement.</p>