The short & sweet answer to : Why IQurayable Vs IEnumerble Or, List …

Fact: What happens with IQueryable<T> is different than with sequences. An instance of IQueryable<T> receives an expression tree it can inspect to decide what processing it should perform.

In principle, as soon as we start enumerating the content of object type; say Customers for example, then expression tree it contains gets analyzed, SQL is generated and executed, and the results of the database query are returned as Customers objects.I don’t want to go into detail about how things work here, but IQueryable is more powerful than sequences based on IEnumerable because intelligent processing based on the analysis of expression trees can happen. By examining a complete query through its expression tree representation, a tool can take smart decisions and make powerful optimizations. IQueryable and expression trees are suitable for cases where IEnumerable and its pipelining pattern are not flexible enough.Deferred query execution with expression trees allow LINQ to SQL to optimize a query containing multiple nested or complex queries into the fewest number of efficient SQL statements possible. If LINQ to SQL were to use a pipelining pattern like the one supported by IEnumerable<T>, it would only be able to execute several small queries in cascade against databases instead of a reduced number of optimized queries. (Courtesy : Linq in Action ISBN 1-933988-16-9)Another Reference :Using IQueryable let LINQ move some additional work into DB by creating different SQL queries. e.g. when you try something like GetAll().Where(condition) and use List all items are queried from DB and where condition is checked application-side. When you use IQueryable it can be moved to DB and proper items are returneD directly from there. There are a few detailed explinatinos can be found here @

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s