Ienumerable

IEnumerable, and its generic counterpart IEnumerable<T> are .NET interfaces for iterating (or enumerating) through a collection of items.

Iqueryable

.NET Framework Interface, providing functionality to evaluate queries against a specific data source wherein the type of the data is not specified.



Faster able specific

Example

"Iqueryable is faster than ienumerable if we are dealing with huge amounts of data from database because iqueryable gets only required data from database where as ienumerable gets all the data regardless of the necessity from the database"

from question  

What is the difference between IQueryable<T> and IEnumerable<T>?

"I assume applying iqueryable will be much faster than the ienumerable not to forget i was able to use iqueryable on the other entities without any issues"

from question  

Use IQueryable on stored procedure in Entity Framework

"That is why iqueryable is considered faster because there is a lot less data that needs to be processed because you where able to ask a more specific question to the server;the reason iqueryable has not replaced ienumerable everywhere is because the thing you are asking a question has to be able to understand the question you are asking a question"

from question  

IQueryable vs IEnumerable: is IQueryable always better and faster?

Larger filter possible

Example

"I d say iqueryable is more suitable for interaction with a database than ienumerable is"

from question  

AsEnumerable().Take

"With really basic calls to the database iqueryable is way quicker but when do i need to think about using an ienumerable in its place"

from question  

LINQ to Entities - Entity Framework

"But if the ienumerable is much larger than the iqueryable just filter the iqueryable as much as possible on the database side and then use asenumerable to pull it into memory and join there"

from question  

Linq join on IQueryable IEnumerable

Better query linq

Example

"I have read about ienumerable and iqueryable i have read that iqueryable is better with linq because when you use where clauses it creates the exact query it needs but with ienumerable it retrieves all rows from database and then filters on memory"

from question  

IEnumerable and IQueryable, which one does it use when I use the var keyword?

"What i know is using iqueryable is better than ienumerable if another query is going to be performed"

from question  

Do I need to use AsQueryable() for a method that returning IQueryable<Type> in .NET EF

"The ienumerable side of linq which works on in-memory objects that are already in the heap will almost certainly perform better than the iqueryable side which exists to be translated into a native query language like sql"

from question  

Is LINQ faster on a list or a table?

"So if you working with only in-memory data collection ienumerable is a good choice but if you want to query data collection which is connected with database iqueryable is a better choice as you want to query data collection which is connected with database iqueryable reduces network traffic and uses the power of sql language"

from question  

What is the difference between IQueryable<T> and IEnumerable<T>?

Generic instances

Example

"Ienumerable is more generic than iqueryable though all"

from question  

Linq Sum() precision

"Ienumerable is more generic than iqueryable though all instances of iqueryable implement ienumerable and only defines"

from question  

Retrieving 10 records at a time only using LINQ

Others

Example

N your case if you need only data on the client side then return list or ienumerable;iqueryable is better choice for data-tier server side because data-tier server side defer execution

from question  

When to use IQueryable as Return type in web service

Putting the advices together no include but select to fetch only the used data no tolist but as enumerable to fetch data per page instead of all data return ienumerable after all the data is in local memory ienumerable can do more than iqueryable

from question  

Entity Framework - Complex object

Final result will be of type ienumerable and in terms of performance this would be better than iqueryable since here join is taking place between in memory collections

from question  

* (no title is found for this review)

The where extension methods for ienumerable indeed take a system.func which is how you are trying to pass the predicate here;but you re working with iqueryable not ienumerable

from question  

Lambda Func delegate using interface

However when there s a few layers of indirection and a function starts returning an iqueryable instead of ienumerable it gets harder

from question  

MongoDB C# Driver: throw exception when querying on ignored property

There is a very good linq video that i enjoy a lot- it hits more than just ienumerable v iqueryable but it really has some fantastic insight

from question  

Should I return IEnumerable<T> or IQueryable<T> from my DAL?

An ienumerable object has everything in it to enumerate over all the elements you can ask for the first element of the sequence and once you ve got an element you can ask for the next element until there are no more elements;an iqueryable seems similar however the iqueryable does not hold everything to enumerate the sequence

from question  

Nested expression building with linq and Entity Framework

5 the retrieved detached objects should be added to a returned list or you could yield return the results one by one with ienumerable is return type;returning an iqueryable isn t possible in this case but an ienumerable will do as result

from question  

Entity Framework MVC and multiple databases

Entity framework s iqueryable implementation is more picky about creating new objects in objects than regular linq to objects ienumerable

from question  

EF : Projecting data into a sub-class of a class

In simple words all operations on ienumerable causes simple iteratation over all elements well it s lazy ienumerable really slower than iqueryable

from question  

Creating a composite condition using anonymous filter method

The warning exists because an ienumerable can disguise something expensive such as a database call most likely an iqueryable and as ienumerable doesn t have caching as part of it s contract it will re-enumerate the source fresh;this can lead to performance issues later on we have been stung by this a surprising amount and we don t even use iqueryable ours was on domain model traversal

from question  

"Possible multiple enumeration of IEnumerable" issue?

Can you provide any useful example that shows ienumerable could be more useful than iqueryable

from question  

When is IEnumerable preferred over IQueryable in Entity Framework?

For your view to expect an ienumerable you need to change your view declaration to be also if you really need to perform a find use iqueryable first you really need to perform a find use iqueryable return the result as ienumerable since the payload on ienumerable is smaller than iqueryable

from question  

Using a Projection in place of Find() in LINQ

I m not familiar with the infeasability of iqueryable but this blog post seems to indicate that iqueryable is much more preferable to ienumerable because iqueryable allows access to the underlying expression

from question  

Why using Count with IQueryable is considered unfeasible

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0