Ramani Sandeep's Blog

DotNetting – Fast , Easy Way of Developing Applications

IQueryable vs IEnumerable

Posted by Ramani Sandeep on August 26, 2009

The primary difference is that the extension methods defined for IQueryable<T> take Expression objects instead of Functional objects, meaning the delegate it receives is an expression tree instead of a method to invoke.

IEnumerable<T> is great for working with in-memory collections, but IQueryable<T> allows for a remote data source, like a database or web service.

IEnumerable doesn’t have the concept of moving between items, it is a forward only collection. It’s very minimalistic; something that most any data source can provide. Using only this minimal functionality, LINQ can provide all of these great operators.

IQueryable<T> is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).

Hope this helps !!!

Reference Links :

Advertisement

One Response to “IQueryable vs IEnumerable”

  1. Ajay Shankar said

    IEnumerable : LINQ to Object and LINQ to XML.
    IQueryable : LINQ to SQL

    http://blogs.msdn.com/wriju/archive/2008/05/06/linq-ienumerable-t-and-iqueryable-t.aspx

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

 
Follow

Get every new post delivered to your Inbox.

Join 37 other followers