score:3
it extends ienumerable
, iqueryable
and ienumerable<t>
. it may not have methods of its own, but it aggregates these other three interfaces as one, so you don't have to deal with them separately.
score:0
use iqueryable if you want to translate a linq query to an expression tree (system.linq). from an expression tree you can easily translate your linq query to another language (sql for linq to sql. another classic example is linq to google where you want this query :
var searchresult = from result
in google.repository
where result.equals("i love linq")
select result;
to translate to this url :
http://www.google.com/search?hl=en&q=i+love+linq&aq=f&oq=&aqi=g10
then you parse the page to get the results.
score:5
iqueryable<t>
is needed because it defines a contract that is required for a linq provider. many of the extension methods available on iqueryable<t>
are designed to accept expressions rather than delegates.
this is important as a linq provider will need to analyze the expression tree rather than invoke a delegate.
score:12
iqueryable<t>
also extends iqueryable
. basically it's an iqueryable
which can be enumerated in a strongly-typed way. (both iqueryable
and ienumerable<t>
already extend ienumerable
, so it's not adding anything on that front.)
now, having a strongly-typed iqueryable
allows linq to sql (etc) to be strongly typed - otherwise you couldn't write where
clauses etc without casting. the actual linq methods involved are in the queryable
type, largely mirroring the enumerable
methods but taking expression trees instead of delegates. (if you haven't used expression trees before, they're basically data structures describing the code - whereas a delegate is the code itself. so you can execute a delegate, but you can examine an expression tree to see what it would do.)
Source: stackoverflow.com
Related Query
- Explain in small words why IQueryable<T> is needed
- Can someone explain why these two linq queries return different results?
- Why is my code doing lazy loading even after I turned it off at every possible point?
- Why doesn't this code compile in VS2010 with .NET 4.0?
- LINQ Query - Explanation needed of why these examples are different
- Why is this code with PredicateBuilder not working?
- LINQ Source Code Available
- Can someone explain LINQ's intersect properly to me? I don't understand why this doesn't work
- Why do these three pieces of LINQ code produce different (or erroneous) results?
- .NET 4 Code Contracts: "requires unproven: source != null"
- Can Someone Explain This MSDN Code To Me In English?
- Why I see so much code duplication in Linq in Reflector?
- Why not reveal the type and identity of the source to the client?
- Why are parenthesis needed in F# using method chaining query expression where clause?
- creating Linq to sqlite dbml from DbLinq source code
- why does this linq code get exponentially slower when applying First() to projection?
- Convert this LINQ code back to a Loop (or Why is this object sometimes null)
- Why did my code work when I changed it from IEnumerable to List?
- Why this Linq code always throws System.StackOverflowException?
- Why are stored procedures, functions, and views put into a .dbml file instead of the code file?
- Why the extension method of where for LINQ in this code would print out a single number while it shouldn't print anything at all?
- Can someone tell me why this simple bit of c# code won't work, involves recursively calling method from within itself to get the root category ID
- How best to optimise this small bit of c# Linq code
- Will someone explain me this LINQ Query in Detail, which I have applied on SharePoint Project ? Why P object is used?
- source code for LINQ 101 samples
- Why Entity Framework Code First one to many Doesn't work properly
- Why is linq result updated, if a source is updated afterwards?
- I would like others to explain this piece of code to me
- C# XML - Why does this Code keep failing with 0x3A Error?
- Can anybody explain me what is going on here in the below two lambda expressions? Why I am getting two different results?
More Query from same tag
- LINQ to Entities Skip and Take
- collation conflict
- How to Group a List of Objects by a Running Total?
- LINQ : How to set value of Take() from a field in current query
- Is there any way to use an extension method in an object initializer block in C#
- LINQ Expression tree avoid inner cast to object
- Dynamically concatenate observables
- How can I update an element of an existing XML file in c# Windows 8 App?
- Nested foreach conversion to LINQ with a condition on two lists
- Frequency table with zero counts for all values
- Why does the type of my DataSource seem to change when I call .OrderBy on it before passing it to a BindingSource?
- Invalidoperationexception when using EnumerableRowCollection and DateTime
- List with dates, times and a string ref
- How to do a primary key to equal to an array of int[] in LINQ?
- C# Generic Passing different objects with same properties
- Simple JOIN Syntax Not Working in Entity Framework
- LINQ to Entities query in "dot notation"
- Linq expressions with Linq to Entities
- How to cope with an Observable collection of classes
- Linq to return all rows with the same (lowest) value
- Write a translatable method for LINQ TO Entities
- Can LINQ To SQL generate invalid SQL?
- Linq distinct and max: How to get rid of duplicates
- Casting Linq Query Results to an Interface
- how to use variable value in LINQ to entity
- Using a string to access a table through DbContext
- Dynamic CRM :Contains<> is not working in CRM
- LINQ Filter anonymous type based on IEnumerable values within type
- LINQ - Assign a Value to Anonymous Type's Read Only Property
- Linq statement involving index based update of value not working