Microsoft > LINQ >> Introduction To LINQ Views : 5903
Rate This Article :

IEnumerable Vs IQueryable

IEnumerable

IQueryable

IEnumerable exists in System.Collections Namespace.

IQueryable exists in System.Linq Namespace.

IEnumerable is the best way to query data from in-memory collections like List, Array etc.

IQueryable is best the best way to query data from out-memory (like databases) collections.

While Query data from database using select, IEnumerable execute select query in server and loads data in in-memory on client and it applies filtering of data.

IQueryable executes select query in the server with all filters.

IEnumerable is suitable for LINQ to Object and LINQ to XML queries.

IQueryable is suitable for LINQ to SQL queries.

IEnumerable supports deferred execution.

IQueryable supports deferred execution.

IEnumerable doesn’t support lazy loading.

IQueryable support lazy loading. Hence it is suitable for paging like scenarios.

About Author
Raj Kumar
Total Posts 55
Developer in .Net!
Comment this article
Name*
Email Address* (Will not be shown on this website.)
Comments*
Enter Image Text*
   
View All Comments
Srikanth Puri
Nice comparison. Could you please provide an example code snippet for this
  Privacy   Terms Of Use   Contact Us
© 2016 Developerin.Net. All rights reserved.
Trademarks and Article Images mentioned in this site may belongs to Microsoft and other respective trademark owners.
Articles, Tutorials and all other content offered here is for educational purpose only and its author copyrights.