What is the use of IQueryable in the context of Linq.
means How can use IQueryable and how it is better from IEnumerable?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandeep ShekhawatPosted Jun 14, 2011, 1:04 AM
Posted Jun 14, 2011, 1:04 AM
The primary difference is that the extension methods defined for IQueryable take Expression objects instead of Functional objects, meaning the delegate it receives is an expression tree instead of a method to invoke.
IEnumerable is great for working with in-memory collections, but IQueryable 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 is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).
Hope this helps !!!
Sourcehttp://jonkruger.com/blog/2007/10/19/iqueryable-vs-ienumerable-in-linq-to-sql-queries/
Jaganathan BantheswaranPosted Jun 14, 2011, 12:48 AM
First of all, IQueryable
IEnumerable
What IQueryable
The expression can simply be a constant expression of the object itself or a more complex tree of a composed set of query operators and operands. The query provider's IQueryProvider.Execute() or IQueryProvider.CreateQuery() methods are called with an Expression passed to it, and then either a query result or another IQueryable is returned, respectively.
Source: Link