The Expression Tree API
The main purpose of expression trees is to allow the inspection of user-written code at runtime, through the object model provided for them in System.Linq.Expressions
. In this section, we take a look at the API for those expressions.
Expression
Base Class
At the root of the class hierarchy of the expression tree object model is the Expression
abstract base class. From a data point of view, it has a few properties:
• Type
indicates the runtime type represented by the node in the tree. Every node in an expression tree has a type that may be derived from its children. For example, if a
and b
are both Int32, the BinaryExpression
representing the addition of a
and b
will also be of type Int32.
• NodeType
is of type ExpressionType ...
Get C# 4.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.