IEnumerable Vs IQueryable

Posted By : Bipul Kumar Tiwari,

IEnumerable and IQueryable are used for data manipulation in LINQ from the database and collections. The major difference are:

IEnumerable IQueryable
IEnumerable exists in System.Collections Namespace. IQueryable exists in System.Linq Namespace.
IEnumerable have No base interface. IQueryable Derives from IEnumerable .
IEnumerable not supported Lazy Loading . Hence not suitable for paging like scenarios. IQueryable supported Lazy Loading .
While querying data from the database, IEnumerable executes "select query" on the server-side, loads data in-memory on the client-side and then filters the data. Hence does more work and becomes slow. While querying data from a database, IQueryable executes a "select query" on server-side with all filters. Hence does less work and becomes fast.
IEnumerable Suitable for LINQ to Object and LINQ to XML queries. IQueryable is suitable for LINQ to SQL queries.
IEnumerable Doesn’t support Custom Query. IQueryable Supports Custom Query using CreateQuery and Execute methods..

Related Articles


About the Author

Its me BIPUL who is logically minded creative at heart , a good communicator , a self taught full stack developer. I constantly focuses on my thinking , reading , collecting and creating my work in a order to enhance my skills.

I discover new dimensions for growing bussiness with a proven record in creating database and programming. I have a strong technical skills as well as strong interpersonal skills. Read more...

Browse By Category

Popular Articles