Expression Trees in LINQ

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

In LINQ, expression trees are used to represent structured queries that target sources of data that implement IQueryable<T>. For example, the LINQ to SQL provider implements the IQueryable<T> interface for querying relational data stores. The C# and Visual Basic compilers compile queries that target such data sources into code that builds an expression tree at runtime. The query provider can then traverse the expression tree data structure and translate it into a query language appropriate for the data source.

Expression trees are also used in LINQ to represent lambda expressions that are assigned to variables of type Expression<TDelegate>.

Expression trees can also be used to create dynamic LINQ queries. For more information, see How to: Use Expression Trees to Build Dynamic Queries. You might also use expression trees if you are building a LINQ provider.

See Also

Tasks

How to: Execute Expression Trees

How to: Modify Expression Trees

Concepts

Expression Trees

Other Resources

LINQ Farm Seed: Using the Expression Tree Visualizer

IQueryable’s Deep Dark Secret