Click here to Skip to main content
15,446,510 members
Articles / All Topics
Technical Blog
Posted 24 Feb 2014

Tagged as


49 bookmarked

IEnumerable Vs IQueryable

Rate me:
Please Sign up or sign in to vote.
4.82/5 (103 votes)
24 Feb 2014CPOL1 min read
IEnumerable Vs IQueryable

Many developers get confused between IEnumerable and IQueryable. When it comes to writing code, both look very similar. However, there are many differences between them which need to be taken care of while writing code. Both have some intended usability scenarios for which they are made.

Listed below are the differences between them based on their properties:

  IEnumerable IQueryable
Namespace System.Collections Namespace System.Linq Namespace
Derives from No base interface Derives from IEnumerable
Deferred Execution Supported Supported
Lazy Loading Not Supported Supported
How does it work While querying data from database, IEnumerable executes select query on server side, load data in-memory on client side and then filter data. Hence does more work and becomes slow. While querying data from database, IQueryable executes select query on server side with all filters. Hence does less work and becomes fast.
Suitable for LINQ to Object and LINQ to XML queries LINQ to SQL queries
Custom Query Doesn’t support Supports using CreateQuery and Execute methods
Extension method
Extension methods supported in IEnumerable takes functional objects. Extension methods supported in IEnumerable takes expression objects, i.e., expression tree.
When to use When querying data from in-memory collections like List, Array, etc. When querying data from out-memory (like remote database, service) collections.
Best Uses In-memory traversal Paging

This article was originally posted at


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Comments and Discussions

QuestionThank you Pin
tripe3way13-Dec-19 1:35
Membertripe3way13-Dec-19 1:35 
PraiseGood effects Pin
hebsiboy22-Oct-16 19:12
Memberhebsiboy22-Oct-16 19:12 
GeneralMy vote of 5 Pin
girishmeena28-Aug-16 4:54
Membergirishmeena28-Aug-16 4:54 
5, because you are helping people. thanks
QuestionIEnumerable Linq capabilities Pin
girishmeena28-Aug-16 4:52
Membergirishmeena28-Aug-16 4:52 
QuestionThanks Pin
Pawan Tiwari9315-May-16 19:49
professionalPawan Tiwari9315-May-16 19:49 
QuestionGood Short Descriptive Pin
Er. Puneet Goel6-Apr-16 0:46
professionalEr. Puneet Goel6-Apr-16 0:46 
GeneralGood Work Pin
Alireza_13623-Apr-16 8:21
MemberAlireza_13623-Apr-16 8:21 
GeneralMy vote of 5 Pin
Chinh Vo Wili27-Jan-16 4:01
professionalChinh Vo Wili27-Jan-16 4:01 
GeneralRe: My vote of 5 Pin
Adarsh Chaurasia - Passionate Trainer22-Mar-16 5:58
professionalAdarsh Chaurasia - Passionate Trainer22-Mar-16 5:58 
Suggestiongood article Pin
toumir24-Nov-15 22:38
Membertoumir24-Nov-15 22:38 
QuestionDifference between IEnumerable VS IQueryable:- Pin
Member 1057063910-Aug-15 18:23
MemberMember 1057063910-Aug-15 18:23 
QuestionThank you Pin
Mahsa Hassankashi20-Sep-14 12:11
MemberMahsa Hassankashi20-Sep-14 12:11 
AnswerRe: Thank you Pin
Member 408341017-Jun-15 5:51
MemberMember 408341017-Jun-15 5:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.