IQueryable vs IQueryable <T>

I'm just wondering why there is a version of IQueryable<T> without a common feature?

+4
source share
2 answers

The generic IQueryable<T> is the one you most often use in the signature method, etc. non-generic IQueryable exists mainly for giving you a weakly typed entry point, mainly for dynamic query creation scripts .

LINQ Matt Warren : Creating an IQueryable Provider - Part I

You can use generic IQueryable<T> wherever possible.

+4
source

I assume the same reason John Skeet gives the Difference between IEnumerable and IEnumerable <T>? to enable foreach . IQuerable will be discarded until IEnumerable , while IQueryable<T> will not.

Also see Marcin's answer about using dynamic query building scripts.

+1
source

Source: https://habr.com/ru/post/1499815/


All Articles