Click here to Skip to main content
13,189,324 members (66,581 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

135.3K views
42 bookmarked
Posted 24 Feb 2014

IEnumerable Vs IQueryable

Rate this:
Please Sign up or sign in to vote.
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
parameter
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

License

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

Share

About the Author

Adarsh Chaurasia - Passionate Trainer
Instructor / Trainer
India India
Innovative technology professional who takes pride in building complex solutions with basic technology, getting the most from a company’s technology investment. Recognised as a problem solver focused on making technology work. Accomplished researcher who turns challenges into building blocks to learn new technology, master advanced stills and streamline processes. Applies natural talent to translate a love of learning into love of teaching, and helping others to learn.

♛ Strengths & Area of expertise include:

✔ Full Stack Enterprise Web Development
✔ Multi-Threaded Programming
✔ Object Oriented Development
✔ REST APIs Development & Integration
✔ Distributed/Client Server System
✔ TDD & Behavior Driven Development (BDD)
✔ Database Design & Development
✔ Exceptional Analytical & Quick Learning Skill
✔ Team & Client Communication
✔ Proactive & Organization Development Attitude

You may also be interested in...

Comments and Discussions

 
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 
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 (Learner|Consultant|Mentor|Tech22-Mar-16 5:58
professionalAdarsh Chaurasia (Learner|Consultant|Mentor|Tech22-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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171016.2 | Last Updated 24 Feb 2014
Article Copyright 2014 by Adarsh Chaurasia - Passionate Trainer
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid