Expression Class

Definition

Provides the base class from which the classes that represent expression tree nodes are derived. It also contains static (Shared in Visual Basic) factory methods to create the various node types. This is an abstract class.

public ref class Expression abstract
public abstract class Expression
type Expression = class
Public MustInherit Class Expression
Inheritance
Expression
Derived

Examples

The following code example shows how to create a block expression. The block expression consists of two MethodCallExpression objects and one ConstantExpression object.

// Add the following directive to your file:
// using System.Linq.Expressions;

// The block expression allows for executing several expressions sequentually.
// When the block expression is executed,
// it returns the value of the last expression in the sequence.
BlockExpression blockExpr = Expression.Block(
    Expression.Call(
        null,
        typeof(Console).GetMethod("Write", new Type[] { typeof(String) }),
        Expression.Constant("Hello ")
       ),
    Expression.Call(
        null,
        typeof(Console).GetMethod("WriteLine", new Type[] { typeof(String) }),
        Expression.Constant("World!")
        ),
    Expression.Constant(42)
);

Console.WriteLine("The result of executing the expression tree:");
// The following statement first creates an expression tree,
// then compiles it, and then executes it.
var result = Expression.Lambda<Func<int>>(blockExpr).Compile()();

// Print out the expressions from the block expression.
Console.WriteLine("The expressions from the block expression:");
foreach (var expr in blockExpr.Expressions)
    Console.WriteLine(expr.ToString());

// Print out the result of the tree execution.
Console.WriteLine("The return value of the block expression:");
Console.WriteLine(result);

// This code example produces the following output:
//
// The result of executing the expression tree:
// Hello World!

// The expressions from the block expression:
// Write("Hello ")
// WriteLine("World!")
// 42

// The return value of the block expression:
// 42
' Add the following directive to your file:
' Imports System.Linq.Expressions

' The block expression enables you to execute several expressions sequentually.
' When the block expression is executed,
' it returns the value of the last expression in the sequence.
Dim blockExpr As BlockExpression = Expression.Block(
    Expression.Call(
        Nothing,
        GetType(Console).GetMethod("Write", New Type() {GetType(String)}),
        Expression.Constant("Hello ")
       ),
    Expression.Call(
        Nothing,
        GetType(Console).GetMethod("WriteLine", New Type() {GetType(String)}),
        Expression.Constant("World!")
        ),
    Expression.Constant(42)
)

Console.WriteLine("The result of executing the expression tree:")
' The following statement first creates an expression tree,
' then compiles it, and then executes it.           
Dim result = Expression.Lambda(Of Func(Of Integer))(blockExpr).Compile()()

' Print the expressions from the block expression.
Console.WriteLine("The expressions from the block expression:")
For Each expr In blockExpr.Expressions
    Console.WriteLine(expr.ToString())
Next

' Print the result of the tree execution.
Console.WriteLine("The return value of the block expression:")
Console.WriteLine(result)

' This code example produces the following output:
'
' The result of executing the expression tree:
' Hello World!

' The expressions from the block expression:
' Write("Hello ")
' WriteLine("World!")
' 42

' The return value of the block expression:
' 42

Constructors

Expression()

Constructs a new instance of Expression.

Expression(ExpressionType, Type)
Obsolete.
Obsolete.

Initializes a new instance of the Expression class.

Properties

CanReduce

Indicates that the node can be reduced to a simpler node. If this returns true, Reduce() can be called to produce the reduced form.

NodeType

Gets the node type of this Expression.

Type

Gets the static type of the expression that this Expression represents.

Methods

Accept(ExpressionVisitor)

Dispatches to the specific visit method for this node type. For example, MethodCallExpression calls the VisitMethodCall(MethodCallExpression).

Add(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic addition operation that does not have overflow checking.

Add(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic addition operation that does not have overflow checking. The implementing method can be specified.

AddAssign(Expression, Expression)

Creates a BinaryExpression that represents an addition assignment operation that does not have overflow checking.

AddAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an addition assignment operation that does not have overflow checking.

AddAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents an addition assignment operation that does not have overflow checking.

AddAssignChecked(Expression, Expression)

Creates a BinaryExpression that represents an addition assignment operation that has overflow checking.

AddAssignChecked(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an addition assignment operation that has overflow checking.

AddAssignChecked(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents an addition assignment operation that has overflow checking.

AddChecked(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic addition operation that has overflow checking.

AddChecked(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic addition operation that has overflow checking. The implementing method can be specified.

And(Expression, Expression)

Creates a BinaryExpression that represents a bitwise AND operation.

And(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise AND operation. The implementing method can be specified.

AndAlso(Expression, Expression)

Creates a BinaryExpression that represents a conditional AND operation that evaluates the second operand only if the first operand evaluates to true.

AndAlso(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a conditional AND operation that evaluates the second operand only if the first operand is resolved to true. The implementing method can be specified.

AndAssign(Expression, Expression)

Creates a BinaryExpression that represents a bitwise AND assignment operation.

AndAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise AND assignment operation.

AndAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a bitwise AND assignment operation.

ArrayAccess(Expression, Expression[])

Creates an IndexExpression to access an array.

ArrayAccess(Expression, IEnumerable<Expression>)

Creates an IndexExpression to access a multidimensional array.

ArrayIndex(Expression, Expression)

Creates a BinaryExpression that represents applying an array index operator to an array of rank one.

ArrayIndex(Expression, Expression[])

Creates a MethodCallExpression that represents applying an array index operator to a multidimensional array.

ArrayIndex(Expression, IEnumerable<Expression>)

Creates a MethodCallExpression that represents applying an array index operator to an array of rank more than one.

ArrayLength(Expression)

Creates a UnaryExpression that represents an expression for obtaining the length of a one-dimensional array.

Assign(Expression, Expression)

Creates a BinaryExpression that represents an assignment operation.

Bind(MemberInfo, Expression)

Creates a MemberAssignment that represents the initialization of a field or property.

Bind(MethodInfo, Expression)

Creates a MemberAssignment that represents the initialization of a member by using a property accessor method.

Block(Expression, Expression)

Creates a BlockExpression that contains two expressions and has no variables.

Block(Expression, Expression, Expression)

Creates a BlockExpression that contains three expressions and has no variables.

Block(Expression, Expression, Expression, Expression)

Creates a BlockExpression that contains four expressions and has no variables.

Block(Expression, Expression, Expression, Expression, Expression)

Creates a BlockExpression that contains five expressions and has no variables.

Block(Expression[])

Creates a BlockExpression that contains the given expressions and has no variables.

Block(IEnumerable<Expression>)

Creates a BlockExpression that contains the given expressions and has no variables.

Block(IEnumerable<ParameterExpression>, Expression[])

Creates a BlockExpression that contains the given variables and expressions.

Block(IEnumerable<ParameterExpression>, IEnumerable<Expression>)

Creates a BlockExpression that contains the given variables and expressions.

Block(Type, Expression[])

Creates a BlockExpression that contains the given expressions, has no variables and has specific result type.

Block(Type, IEnumerable<Expression>)

Creates a BlockExpression that contains the given expressions, has no variables and has specific result type.

Block(Type, IEnumerable<ParameterExpression>, Expression[])

Creates a BlockExpression that contains the given variables and expressions.

Block(Type, IEnumerable<ParameterExpression>, IEnumerable<Expression>)

Creates a BlockExpression that contains the given variables and expressions.

Break(LabelTarget)

Creates a GotoExpression representing a break statement.

Break(LabelTarget, Expression)

Creates a GotoExpression representing a break statement. The value passed to the label upon jumping can be specified.

Break(LabelTarget, Expression, Type)

Creates a GotoExpression representing a break statement with the specified type. The value passed to the label upon jumping can be specified.

Break(LabelTarget, Type)

Creates a GotoExpression representing a break statement with the specified type.

Call(Expression, MethodInfo)

Creates a MethodCallExpression that represents a call to a method that takes no arguments.

Call(Expression, MethodInfo, Expression, Expression)

Creates a MethodCallExpression that represents a call to a method that takes two arguments.

Call(Expression, MethodInfo, Expression, Expression, Expression)

Creates a MethodCallExpression that represents a call to a method that takes three arguments.

Call(Expression, MethodInfo, Expression[])

Creates a MethodCallExpression that represents a call to a method that takes arguments.

Call(Expression, MethodInfo, IEnumerable<Expression>)

Creates a MethodCallExpression that represents a call to a method that takes arguments.

Call(Expression, String, Type[], Expression[])

Creates a MethodCallExpression that represents a call to a method by calling the appropriate factory method.

Call(MethodInfo, Expression)

Creates a MethodCallExpression that represents a call to a static (Shared in Visual Basic) method that takes one argument.

Call(MethodInfo, Expression, Expression)

Creates a MethodCallExpression that represents a call to a static method that takes two arguments.

Call(MethodInfo, Expression, Expression, Expression)

Creates a MethodCallExpression that represents a call to a static method that takes three arguments.

Call(MethodInfo, Expression, Expression, Expression, Expression)

Creates a MethodCallExpression that represents a call to a static method that takes four arguments.

Call(MethodInfo, Expression, Expression, Expression, Expression, Expression)

Creates a MethodCallExpression that represents a call to a static method that takes five arguments.

Call(MethodInfo, Expression[])

Creates a MethodCallExpression that represents a call to a static (Shared in Visual Basic) method that has arguments.

Call(MethodInfo, IEnumerable<Expression>)

Creates a MethodCallExpression that represents a call to a static (Shared in Visual Basic) method.

Call(Type, String, Type[], Expression[])

Creates a MethodCallExpression that represents a call to a static (Shared in Visual Basic) method by calling the appropriate factory method.

Catch(ParameterExpression, Expression)

Creates a CatchBlock representing a catch statement with a reference to the caught Exception object for use in the handler body.

Catch(ParameterExpression, Expression, Expression)

Creates a CatchBlock representing a catch statement with an Exception filter and a reference to the caught Exception object.

Catch(Type, Expression)

Creates a CatchBlock representing a catch statement.

Catch(Type, Expression, Expression)

Creates a CatchBlock representing a catch statement with an Exception filter but no reference to the caught Exception object.

ClearDebugInfo(SymbolDocumentInfo)

Creates a DebugInfoExpression for clearing a sequence point.

Coalesce(Expression, Expression)

Creates a BinaryExpression that represents a coalescing operation.

Coalesce(Expression, Expression, LambdaExpression)

Creates a BinaryExpression that represents a coalescing operation, given a conversion function.

Condition(Expression, Expression, Expression)

Creates a ConditionalExpression that represents a conditional statement.

Condition(Expression, Expression, Expression, Type)

Creates a ConditionalExpression that represents a conditional statement.

Constant(Object)

Creates a ConstantExpression that has the Value property set to the specified value.

Constant(Object, Type)

Creates a ConstantExpression that has the Value and Type properties set to the specified values.

Continue(LabelTarget)

Creates a GotoExpression representing a continue statement.

Continue(LabelTarget, Type)

Creates a GotoExpression representing a continue statement with the specified type.

Convert(Expression, Type)

Creates a UnaryExpression that represents a type conversion operation.

Convert(Expression, Type, MethodInfo)

Creates a UnaryExpression that represents a conversion operation for which the implementing method is specified.

ConvertChecked(Expression, Type)

Creates a UnaryExpression that represents a conversion operation that throws an exception if the target type is overflowed.

ConvertChecked(Expression, Type, MethodInfo)

Creates a UnaryExpression that represents a conversion operation that throws an exception if the target type is overflowed and for which the implementing method is specified.

DebugInfo(SymbolDocumentInfo, Int32, Int32, Int32, Int32)

Creates a DebugInfoExpression with the specified span.

Decrement(Expression)

Creates a UnaryExpression that represents the decrementing of the expression by 1.

Decrement(Expression, MethodInfo)

Creates a UnaryExpression that represents the decrementing of the expression by 1.

Default(Type)

Creates a DefaultExpression that has the Type property set to the specified type.

Divide(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic division operation.

Divide(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic division operation. The implementing method can be specified.

DivideAssign(Expression, Expression)

Creates a BinaryExpression that represents a division assignment operation that does not have overflow checking.

DivideAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a division assignment operation that does not have overflow checking.

DivideAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a division assignment operation that does not have overflow checking.

Dynamic(CallSiteBinder, Type, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

Dynamic(CallSiteBinder, Type, Expression, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

Dynamic(CallSiteBinder, Type, Expression, Expression, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

Dynamic(CallSiteBinder, Type, Expression, Expression, Expression, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

Dynamic(CallSiteBinder, Type, Expression[])

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

Dynamic(CallSiteBinder, Type, IEnumerable<Expression>)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

ElementInit(MethodInfo, Expression[])

Creates an ElementInit, given an array of values as the second argument.

ElementInit(MethodInfo, IEnumerable<Expression>)

Creates an ElementInit, given an IEnumerable<T> as the second argument.

Empty()

Creates an empty expression that has Void type.

Equal(Expression, Expression)

Creates a BinaryExpression that represents an equality comparison.

Equal(Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression that represents an equality comparison. The implementing method can be specified.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExclusiveOr(Expression, Expression)

Creates a BinaryExpression that represents a bitwise XOR operation, using op_ExclusiveOr for user-defined types.

ExclusiveOr(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise XOR operation, using op_ExclusiveOr for user-defined types. The implementing method can be specified.

ExclusiveOrAssign(Expression, Expression)

Creates a BinaryExpression that represents a bitwise XOR assignment operation, using op_ExclusiveOr for user-defined types.

ExclusiveOrAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise XOR assignment operation, using op_ExclusiveOr for user-defined types.

ExclusiveOrAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a bitwise XOR assignment operation, using op_ExclusiveOr for user-defined types.

Field(Expression, FieldInfo)

Creates a MemberExpression that represents accessing a field.

Field(Expression, String)

Creates a MemberExpression that represents accessing a field given the name of the field.

Field(Expression, Type, String)

Creates a MemberExpression that represents accessing a field.

GetActionType(Type[])

Creates a Type object that represents a generic Action delegate type that has specific type arguments.

GetDelegateType(Type[])

Gets a Type object that represents a generic Func<TResult> or Action delegate type that has specific type arguments.

GetFuncType(Type[])

Creates a Type object that represents a generic Func<TResult> delegate type that has specific type arguments. The last type argument specifies the return type of the created delegate.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
Goto(LabelTarget)

Creates a GotoExpression representing a "go to" statement.

Goto(LabelTarget, Expression)

Creates a GotoExpression representing a "go to" statement. The value passed to the label upon jumping can be specified.

Goto(LabelTarget, Expression, Type)

Creates a GotoExpression representing a "go to" statement with the specified type. The value passed to the label upon jumping can be specified.

Goto(LabelTarget, Type)

Creates a GotoExpression representing a "go to" statement with the specified type.

GreaterThan(Expression, Expression)

Creates a BinaryExpression that represents a "greater than" numeric comparison.

GreaterThan(Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression that represents a "greater than" numeric comparison. The implementing method can be specified.

GreaterThanOrEqual(Expression, Expression)

Creates a BinaryExpression that represents a "greater than or equal" numeric comparison.

GreaterThanOrEqual(Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression that represents a "greater than or equal" numeric comparison.

IfThen(Expression, Expression)

Creates a ConditionalExpression that represents a conditional block with an if statement.

IfThenElse(Expression, Expression, Expression)

Creates a ConditionalExpression that represents a conditional block with if and else statements.

Increment(Expression)

Creates a UnaryExpression that represents the incrementing of the expression value by 1.

Increment(Expression, MethodInfo)

Creates a UnaryExpression that represents the incrementing of the expression by 1.

Invoke(Expression, Expression[])

Creates an InvocationExpression that applies a delegate or lambda expression to a list of argument expressions.

Invoke(Expression, IEnumerable<Expression>)

Creates an InvocationExpression that applies a delegate or lambda expression to a list of argument expressions.

IsFalse(Expression)

Returns whether the expression evaluates to false.

IsFalse(Expression, MethodInfo)

Returns whether the expression evaluates to false.

IsTrue(Expression)

Returns whether the expression evaluates to true.

IsTrue(Expression, MethodInfo)

Returns whether the expression evaluates to true.

Label()

Creates a LabelTarget representing a label with void type and no name.

Label(LabelTarget)

Creates a LabelExpression representing a label without a default value.

Label(LabelTarget, Expression)

Creates a LabelExpression representing a label with the given default value.

Label(String)

Creates a LabelTarget representing a label with void type and the given name.

Label(Type)

Creates a LabelTarget representing a label with the given type.

Label(Type, String)

Creates a LabelTarget representing a label with the given type and name.

Lambda(Expression, Boolean, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type from the expression body, a parameter that indicates whether tail call optimization will be applied, and an enumerable collection of parameter expressions. It can be used when the delegate type is not known at compile time.

Lambda(Expression, Boolean, ParameterExpression[])

Creates a LambdaExpression by first constructing a delegate type from the expression body, a parameter that indicates whether tail call optimization will be applied, and an array of parameter expressions. It can be used when the delegate type is not known at compile time.

Lambda(Expression, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type from the expression body, and an enumerable collection of parameter expressions. It can be used when the delegate type is not known at compile time.

Lambda(Expression, ParameterExpression[])

Creates a LambdaExpression by first constructing a delegate type from the expression body, and an array of parameter expressions. It can be used when the delegate type is not known at compile time.

Lambda(Expression, String, Boolean, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type from the expression body, the name for the lambda, a parameter that indicates whether tail call optimization will be applied, and an enumerable collection of parameter expressions. It can be used when the delegate type is not known at compile time.

Lambda(Expression, String, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type from the expression body, the name for the lambda, and an enumerable collection of parameter expressions. It can be used when the delegate type is not known at compile time.

Lambda(Type, Expression, Boolean, IEnumerable<ParameterExpression>)

Creates a LambdaExpression where the delegate type is known at compile time, with a parameter that indicates whether tail call optimization will be applied, and an enumerable collection of parameter expressions.

Lambda(Type, Expression, Boolean, ParameterExpression[])

Creates a LambdaExpression where the delegate type is known at compile time, with a parameter that indicates whether tail call optimization will be applied, and an array of parameter expressions.

Lambda(Type, Expression, IEnumerable<ParameterExpression>)

Creates a LambdaExpression where the delegate type is known at compile time, with an enumerable collection of parameter expressions.

Lambda(Type, Expression, ParameterExpression[])

Creates a LambdaExpression where the delegate type is known at compile time, with an array of parameter expressions.

Lambda(Type, Expression, String, Boolean, IEnumerable<ParameterExpression>)

Creates a LambdaExpression where the delegate type is known at compile time, with the name for the lambda, a parameter that indicates whether tail call optimization will be applied, and an enumerable collection of parameter expressions.

Lambda(Type, Expression, String, IEnumerable<ParameterExpression>)

Creates a LambdaExpression where the delegate type is known at compile time, with the name for the lambda, and an enumerable collection of parameter expressions.

Lambda<TDelegate>(Expression, Boolean, IEnumerable<ParameterExpression>)

Creates an Expression<TDelegate> where the delegate type is known at compile time, with a parameter that indicates whether tail call optimization will be applied, and an enumerable collection of parameter expressions.

Lambda<TDelegate>(Expression, Boolean, ParameterExpression[])

Creates an Expression<TDelegate> where the delegate type is known at compile time, with a parameter that indicates whether tail call optimization will be applied, and an array of parameter expressions.

Lambda<TDelegate>(Expression, IEnumerable<ParameterExpression>)

Creates an Expression<TDelegate> where the delegate type is known at compile time, with an enumerable collection of parameter expressions.

Lambda<TDelegate>(Expression, ParameterExpression[])

Creates an Expression<TDelegate> where the delegate type is known at compile time, with an array of parameter expressions.

Lambda<TDelegate>(Expression, String, Boolean, IEnumerable<ParameterExpression>)

Creates an Expression<TDelegate> where the delegate type is known at compile time, with the name for the lambda, a parameter that indicates whether tail call optimization will be applied, and an enumerable collection of parameter expressions.

Lambda<TDelegate>(Expression, String, IEnumerable<ParameterExpression>)

Creates an Expression<TDelegate> where the delegate type is known at compile time, with the name for the lambda, and an enumerable collection of parameter expressions.

LeftShift(Expression, Expression)

Creates a BinaryExpression that represents a bitwise left-shift operation.

LeftShift(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise left-shift operation.

LeftShiftAssign(Expression, Expression)

Creates a BinaryExpression that represents a bitwise left-shift assignment operation.

LeftShiftAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise left-shift assignment operation.

LeftShiftAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a bitwise left-shift assignment operation.

LessThan(Expression, Expression)

Creates a BinaryExpression that represents a "less than" numeric comparison.

LessThan(Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression that represents a "less than" numeric comparison.

LessThanOrEqual(Expression, Expression)

Creates a BinaryExpression that represents a " less than or equal" numeric comparison.

LessThanOrEqual(Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression that represents a "less than or equal" numeric comparison.

ListBind(MemberInfo, ElementInit[])

Creates a MemberListBinding where the member is a field or property.

ListBind(MemberInfo, IEnumerable<ElementInit>)

Creates a MemberListBinding where the member is a field or property.

ListBind(MethodInfo, ElementInit[])

Creates a MemberListBinding object based on a specified property accessor method.

ListBind(MethodInfo, IEnumerable<ElementInit>)

Creates a MemberListBinding based on a specified property accessor method.

ListInit(NewExpression, ElementInit[])

Creates a ListInitExpression that uses specified ElementInit objects to initialize a collection.

ListInit(NewExpression, Expression[])

Creates a ListInitExpression that uses a method named "Add" to add elements to a collection.

ListInit(NewExpression, IEnumerable<ElementInit>)

Creates a ListInitExpression that uses specified ElementInit objects to initialize a collection.

ListInit(NewExpression, IEnumerable<Expression>)

Creates a ListInitExpression that uses a method named "Add" to add elements to a collection.

ListInit(NewExpression, MethodInfo, Expression[])

Creates a ListInitExpression that uses a specified method to add elements to a collection.

ListInit(NewExpression, MethodInfo, IEnumerable<Expression>)

Creates a ListInitExpression that uses a specified method to add elements to a collection.

Loop(Expression)

Creates a LoopExpression with the given body.

Loop(Expression, LabelTarget)

Creates a LoopExpression with the given body and break target.

Loop(Expression, LabelTarget, LabelTarget)

Creates a LoopExpression with the given body.

MakeBinary(ExpressionType, Expression, Expression)

Creates a BinaryExpression, given the left and right operands, by calling an appropriate factory method.

MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression, given the left operand, right operand and implementing method, by calling the appropriate factory method.

MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo, LambdaExpression)

Creates a BinaryExpression, given the left operand, right operand, implementing method and type conversion function, by calling the appropriate factory method.

MakeCatchBlock(Type, ParameterExpression, Expression, Expression)

Creates a CatchBlock representing a catch statement with the specified elements.

MakeDynamic(Type, CallSiteBinder, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder and one argument.

MakeDynamic(Type, CallSiteBinder, Expression, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder and two arguments.

MakeDynamic(Type, CallSiteBinder, Expression, Expression, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder and three arguments.

MakeDynamic(Type, CallSiteBinder, Expression, Expression, Expression, Expression)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder and four arguments.

MakeDynamic(Type, CallSiteBinder, Expression[])

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

MakeDynamic(Type, CallSiteBinder, IEnumerable<Expression>)

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder.

MakeGoto(GotoExpressionKind, LabelTarget, Expression, Type)

Creates a GotoExpression representing a jump of the specified GotoExpressionKind. The value passed to the label upon jumping can also be specified.

MakeIndex(Expression, PropertyInfo, IEnumerable<Expression>)

Creates an IndexExpression that represents accessing an indexed property in an object.

MakeMemberAccess(Expression, MemberInfo)

Creates a MemberExpression that represents accessing either a field or a property.

MakeTry(Type, Expression, Expression, Expression, IEnumerable<CatchBlock>)

Creates a TryExpression representing a try block with the specified elements.

MakeUnary(ExpressionType, Expression, Type)

Creates a UnaryExpression, given an operand, by calling the appropriate factory method.

MakeUnary(ExpressionType, Expression, Type, MethodInfo)

Creates a UnaryExpression, given an operand and implementing method, by calling the appropriate factory method.

MemberBind(MemberInfo, IEnumerable<MemberBinding>)

Creates a MemberMemberBinding that represents the recursive initialization of members of a field or property.

MemberBind(MemberInfo, MemberBinding[])

Creates a MemberMemberBinding that represents the recursive initialization of members of a field or property.

MemberBind(MethodInfo, IEnumerable<MemberBinding>)

Creates a MemberMemberBinding that represents the recursive initialization of members of a member that is accessed by using a property accessor method.

MemberBind(MethodInfo, MemberBinding[])

Creates a MemberMemberBinding that represents the recursive initialization of members of a member that is accessed by using a property accessor method.

MemberInit(NewExpression, IEnumerable<MemberBinding>)

Represents an expression that creates a new object and initializes a property of the object.

MemberInit(NewExpression, MemberBinding[])

Creates a MemberInitExpression.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Modulo(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic remainder operation.

Modulo(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic remainder operation.

ModuloAssign(Expression, Expression)

Creates a BinaryExpression that represents a remainder assignment operation.

ModuloAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a remainder assignment operation.

ModuloAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a remainder assignment operation.

Multiply(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic multiplication operation that does not have overflow checking.

Multiply(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic multiplication operation that does not have overflow checking.

MultiplyAssign(Expression, Expression)

Creates a BinaryExpression that represents a multiplication assignment operation that does not have overflow checking.

MultiplyAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a multiplication assignment operation that does not have overflow checking.

MultiplyAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a multiplication assignment operation that does not have overflow checking.

MultiplyAssignChecked(Expression, Expression)

Creates a BinaryExpression that represents a multiplication assignment operation that has overflow checking.

MultiplyAssignChecked(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a multiplication assignment operation that has overflow checking.

MultiplyAssignChecked(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a multiplication assignment operation that has overflow checking.

MultiplyChecked(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic multiplication operation that has overflow checking.

MultiplyChecked(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic multiplication operation that has overflow checking.

Negate(Expression)

Creates a UnaryExpression that represents an arithmetic negation operation.

Negate(Expression, MethodInfo)

Creates a UnaryExpression that represents an arithmetic negation operation.

NegateChecked(Expression)

Creates a UnaryExpression that represents an arithmetic negation operation that has overflow checking.

NegateChecked(Expression, MethodInfo)

Creates a UnaryExpression that represents an arithmetic negation operation that has overflow checking. The implementing method can be specified.

New(ConstructorInfo)

Creates a NewExpression that represents calling the specified constructor that takes no arguments.

New(ConstructorInfo, Expression[])

Creates a NewExpression that represents calling the specified constructor with the specified arguments.

New(ConstructorInfo, IEnumerable<Expression>)

Creates a NewExpression that represents calling the specified constructor with the specified arguments.

New(ConstructorInfo, IEnumerable<Expression>, IEnumerable<MemberInfo>)

Creates a NewExpression that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified.

New(ConstructorInfo, IEnumerable<Expression>, MemberInfo[])

Creates a NewExpression that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified as an array.

New(Type)

Creates a NewExpression that represents calling the parameterless constructor of the specified type.

NewArrayBounds(Type, Expression[])

Creates a NewArrayExpression that represents creating an array that has a specified rank.

NewArrayBounds(Type, IEnumerable<Expression>)

Creates a NewArrayExpression that represents creating an array that has a specified rank.

NewArrayInit(Type, Expression[])

Creates a NewArrayExpression that represents creating a one-dimensional array and initializing it from a list of elements.

NewArrayInit(Type, IEnumerable<Expression>)

Creates a NewArrayExpression that represents creating a one-dimensional array and initializing it from a list of elements.

Not(Expression)

Creates a UnaryExpression that represents a bitwise complement operation.

Not(Expression, MethodInfo)

Creates a UnaryExpression that represents a bitwise complement operation. The implementing method can be specified.

NotEqual(Expression, Expression)

Creates a BinaryExpression that represents an inequality comparison.

NotEqual(Expression, Expression, Boolean, MethodInfo)

Creates a BinaryExpression that represents an inequality comparison.

OnesComplement(Expression)

Returns the expression representing the ones complement.

OnesComplement(Expression, MethodInfo)

Returns the expression representing the ones complement.

Or(Expression, Expression)

Creates a BinaryExpression that represents a bitwise OR operation.

Or(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise OR operation.

OrAssign(Expression, Expression)

Creates a BinaryExpression that represents a bitwise OR assignment operation.

OrAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise OR assignment operation.

OrAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a bitwise OR assignment operation.

OrElse(Expression, Expression)

Creates a BinaryExpression that represents a conditional OR operation that evaluates the second operand only if the first operand evaluates to false.

OrElse(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a conditional OR operation that evaluates the second operand only if the first operand evaluates to false.

Parameter(Type)

Creates a ParameterExpression node that can be used to identify a parameter or a variable in an expression tree.

Parameter(Type, String)

Creates a ParameterExpression node that can be used to identify a parameter or a variable in an expression tree.

PostDecrementAssign(Expression)

Creates a UnaryExpression that represents the assignment of the expression followed by a subsequent decrement by 1 of the original expression.

PostDecrementAssign(Expression, MethodInfo)

Creates a UnaryExpression that represents the assignment of the expression followed by a subsequent decrement by 1 of the original expression.

PostIncrementAssign(Expression)

Creates a UnaryExpression that represents the assignment of the expression followed by a subsequent increment by 1 of the original expression.

PostIncrementAssign(Expression, MethodInfo)

Creates a UnaryExpression that represents the assignment of the expression followed by a subsequent increment by 1 of the original expression.

Power(Expression, Expression)

Creates a BinaryExpression that represents raising a number to a power.

Power(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents raising a number to a power.

PowerAssign(Expression, Expression)

Creates a BinaryExpression that represents raising an expression to a power and assigning the result back to the expression.

PowerAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents raising an expression to a power and assigning the result back to the expression.

PowerAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents raising an expression to a power and assigning the result back to the expression.

PreDecrementAssign(Expression)

Creates a UnaryExpression that decrements the expression by 1 and assigns the result back to the expression.

PreDecrementAssign(Expression, MethodInfo)

Creates a UnaryExpression that decrements the expression by 1 and assigns the result back to the expression.

PreIncrementAssign(Expression)

Creates a UnaryExpression that increments the expression by 1 and assigns the result back to the expression.

PreIncrementAssign(Expression, MethodInfo)

Creates a UnaryExpression that increments the expression by 1 and assigns the result back to the expression.

Property(Expression, MethodInfo)

Creates a MemberExpression that represents accessing a property by using a property accessor method.

Property(Expression, PropertyInfo)

Creates a MemberExpression that represents accessing a property.

Property(Expression, PropertyInfo, Expression[])

Creates an IndexExpression representing the access to an indexed property.

Property(Expression, PropertyInfo, IEnumerable<Expression>)

Creates an IndexExpression representing the access to an indexed property.

Property(Expression, String)

Creates a MemberExpression that represents accessing a property.

Property(Expression, String, Expression[])

Creates an IndexExpression representing the access to an indexed property.

Property(Expression, Type, String)

Creates a MemberExpression accessing a property.

PropertyOrField(Expression, String)

Creates a MemberExpression that represents accessing a property or field.

Quote(Expression)

Creates a UnaryExpression that represents an expression that has a constant value of type Expression.

Reduce()

Reduces this node to a simpler expression. If CanReduce returns true, this should return a valid expression. This method can return another node which itself must be reduced.

ReduceAndCheck()

Reduces this node to a simpler expression. If CanReduce returns true, this should return a valid expression. This method can return another node which itself must be reduced.

ReduceExtensions()

Reduces the expression to a known node type (that is not an Extension node) or just returns the expression if it is already a known type.

ReferenceEqual(Expression, Expression)

Creates a BinaryExpression that represents a reference equality comparison.

ReferenceNotEqual(Expression, Expression)

Creates a BinaryExpression that represents a reference inequality comparison.

Rethrow()

Creates a UnaryExpression that represents a rethrowing of an exception.

Rethrow(Type)

Creates a UnaryExpression that represents a rethrowing of an exception with a given type.

Return(LabelTarget)

Creates a GotoExpression representing a return statement.

Return(LabelTarget, Expression)

Creates a GotoExpression representing a return statement. The value passed to the label upon jumping can be specified.

Return(LabelTarget, Expression, Type)

Creates a GotoExpression representing a return statement with the specified type. The value passed to the label upon jumping can be specified.

Return(LabelTarget, Type)

Creates a GotoExpression representing a return statement with the specified type.

RightShift(Expression, Expression)

Creates a BinaryExpression that represents a bitwise right-shift operation.

RightShift(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise right-shift operation.

RightShiftAssign(Expression, Expression)

Creates a BinaryExpression that represents a bitwise right-shift assignment operation.

RightShiftAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a bitwise right-shift assignment operation.

RightShiftAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a bitwise right-shift assignment operation.

RuntimeVariables(IEnumerable<ParameterExpression>)

Creates an instance of RuntimeVariablesExpression.

RuntimeVariables(ParameterExpression[])

Creates an instance of RuntimeVariablesExpression.

Subtract(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic subtraction operation that does not have overflow checking.

Subtract(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic subtraction operation that does not have overflow checking.

SubtractAssign(Expression, Expression)

Creates a BinaryExpression that represents a subtraction assignment operation that does not have overflow checking.

SubtractAssign(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a subtraction assignment operation that does not have overflow checking.

SubtractAssign(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a subtraction assignment operation that does not have overflow checking.

SubtractAssignChecked(Expression, Expression)

Creates a BinaryExpression that represents a subtraction assignment operation that has overflow checking.

SubtractAssignChecked(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents a subtraction assignment operation that has overflow checking.

SubtractAssignChecked(Expression, Expression, MethodInfo, LambdaExpression)

Creates a BinaryExpression that represents a subtraction assignment operation that has overflow checking.

SubtractChecked(Expression, Expression)

Creates a BinaryExpression that represents an arithmetic subtraction operation that has overflow checking.

SubtractChecked(Expression, Expression, MethodInfo)

Creates a BinaryExpression that represents an arithmetic subtraction operation that has overflow checking.

Switch(Expression, Expression, MethodInfo, IEnumerable<SwitchCase>)

Creates a SwitchExpression that represents a switch statement that has a default case.

Switch(Expression, Expression, MethodInfo, SwitchCase[])

Creates a SwitchExpression that represents a switch statement that has a default case.

Switch(Expression, Expression, SwitchCase[])

Creates a SwitchExpression that represents a switch statement that has a default case.

Switch(Expression, SwitchCase[])

Creates a SwitchExpression that represents a switch statement without a default case.

Switch(Type, Expression, Expression, MethodInfo, IEnumerable<SwitchCase>)

Creates a SwitchExpression that represents a switch statement that has a default case.

Switch(Type, Expression, Expression, MethodInfo, SwitchCase[])

Creates a SwitchExpression that represents a switch statement that has a default case.

SwitchCase(Expression, Expression[])

Creates a SwitchCase for use in a SwitchExpression.

SwitchCase(Expression, IEnumerable<Expression>)

Creates a SwitchCase object to be used in a SwitchExpression object.

SymbolDocument(String)

Creates an instance of SymbolDocumentInfo.

SymbolDocument(String, Guid)

Creates an instance of SymbolDocumentInfo.

SymbolDocument(String, Guid, Guid)

Creates an instance of SymbolDocumentInfo.

SymbolDocument(String, Guid, Guid, Guid)

Creates an instance of SymbolDocumentInfo.

Throw(Expression)

Creates a UnaryExpression that represents a throwing of an exception.

Throw(Expression, Type)

Creates a UnaryExpression that represents a throwing of an exception with a given type.

ToString()

Returns a textual representation of the Expression.

TryCatch(Expression, CatchBlock[])

Creates a TryExpression representing a try block with any number of catch statements and neither a fault nor finally block.

TryCatchFinally(Expression, Expression, CatchBlock[])

Creates a TryExpression representing a try block with any number of catch statements and a finally block.

TryFault(Expression, Expression)

Creates a TryExpression representing a try block with a fault block and no catch statements.

TryFinally(Expression, Expression)

Creates a TryExpression representing a try block with a finally block and no catch statements.

TryGetActionType(Type[], Type)

Creates a Type object that represents a generic System.Action delegate type that has specific type arguments.

TryGetFuncType(Type[], Type)

Creates a Type object that represents a generic System.Func delegate type that has specific type arguments. The last type argument specifies the return type of the created delegate.

TypeAs(Expression, Type)

Creates a UnaryExpression that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.

TypeEqual(Expression, Type)

Creates a TypeBinaryExpression that compares run-time type identity.

TypeIs(Expression, Type)

Creates a TypeBinaryExpression.

UnaryPlus(Expression)

Creates a UnaryExpression that represents a unary plus operation.

UnaryPlus(Expression, MethodInfo)

Creates a UnaryExpression that represents a unary plus operation.

Unbox(Expression, Type)

Creates a UnaryExpression that represents an explicit unboxing.

Variable(Type)

Creates a ParameterExpression node that can be used to identify a parameter or a variable in an expression tree.

Variable(Type, String)

Creates a ParameterExpression node that can be used to identify a parameter or a variable in an expression tree.

VisitChildren(ExpressionVisitor)

Reduces the node and then calls the visitor delegate on the reduced expression. The method throws an exception if the node is not reducible.

Applies to