Linq and IQueryable

An IQueryable (and the Generic IQueryable(Of T)) in .NET is the main type that is used to store a Linq query. It is particularly useful as it is enumerable and has to implement IEnumberable too (and the generic equivalent).

It has 3 members: –

  • ElementType
  • Expression
  • Provider

ElementType is very simply the type of each individual item/record returned by the query.

Expression represents the query as an expression tree.  I have already touched on that in my previous posts.

Provider is the object which is able to take the expression and use it to retrieve data.  Typical providers include Linq to SQL, Linq to Entities (for the Entity Framework), Linq to XML etc.  There are many other implementations of Linq providers for all sorts of uses, including Linq to Amazon, Linq to Google etc.

Leave a Reply