Show / Hide Table of Contents

Class ExpressionUnsafe

Provides factory methods for expressions that bypass argument validation. These factory methods should be used with extreme caution, only if type safety guarantees are provided elsewhere. A typical use of these factory methods is for expression deserialization.

Inheritance
System.Object
ExpressionUnsafe
Namespace: System.Linq.Expressions
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public sealed class ExpressionUnsafe : Expression

Methods

ArrayAccess(Expression, IEnumerable<Expression>)

Creates an System.Linq.Expressions.IndexExpression to access a multidimensional array.

Declaration
public static IndexExpression ArrayAccess(Expression array, IEnumerable<Expression> indexes)
Parameters
Type Name Description
System.Linq.Expressions.Expression array

An expression that represents the multidimensional array.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> indexes

An System.Collections.Generic.IEnumerable<> containing expressions used to index the array.

Returns
Type Description
System.Linq.Expressions.IndexExpression

The created System.Linq.Expressions.IndexExpression.

ArrayAccess(Expression, Expression[])

Creates an System.Linq.Expressions.IndexExpression to access an array.

Declaration
public static IndexExpression ArrayAccess(Expression array, Expression[] indexes)
Parameters
Type Name Description
System.Linq.Expressions.Expression array

An expression representing the array to index.

System.Linq.Expressions.Expression[] indexes

An array that contains expressions used to index the array.

Returns
Type Description
System.Linq.Expressions.IndexExpression

The created System.Linq.Expressions.IndexExpression.

ArrayIndex(Expression, IEnumerable<Expression>)

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

Declaration
public static MethodCallExpression ArrayIndex(Expression array, IEnumerable<Expression> indexes)
Parameters
Type Name Description
System.Linq.Expressions.Expression array

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.MethodCallExpression.Object property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> indexes

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.MethodCallExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Arguments properties set to the specified values.

ArrayIndex(Expression, Expression)

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

Declaration
public static BinaryExpression ArrayIndex(Expression array, Expression index)
Parameters
Type Name Description
System.Linq.Expressions.Expression array

An Expression to set the Left property equal to.

System.Linq.Expressions.Expression index

An Expression to set the Right property equal to.

Returns
Type Description
System.Linq.Expressions.BinaryExpression

A BinaryExpression that has the NodeType property equal to ArrayIndex and the Left and Right properties set to the specified values.

ArrayIndex(Expression, Expression[])

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

Declaration
public static MethodCallExpression ArrayIndex(Expression array, Expression[] indexes)
Parameters
Type Name Description
System.Linq.Expressions.Expression array

An array of System.Linq.Expressions.Expression instances - indexes for the array index operation.

System.Linq.Expressions.Expression[] indexes

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.MethodCallExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Arguments properties set to the specified values.

ArrayLength(Expression)

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

Declaration
public static UnaryExpression ArrayLength(Expression array)
Parameters
Type Name Description
System.Linq.Expressions.Expression array

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.UnaryExpression.Operand property equal to.

Returns
Type Description
System.Linq.Expressions.UnaryExpression

A System.Linq.Expressions.UnaryExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.ArrayLength and the System.Linq.Expressions.UnaryExpression.Operand property equal to array.

Exceptions
Type Condition
System.ArgumentNullException

array is null.

System.ArgumentException

array.Type does not represent an array type.

Bind(MemberInfo, Expression)

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

Declaration
public static MemberAssignment Bind(MemberInfo member, Expression expression)
Parameters
Type Name Description
System.Reflection.MemberInfo member

A System.Reflection.MemberInfo to set the System.Linq.Expressions.MemberBinding.Member property equal to.

System.Linq.Expressions.Expression expression

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.MemberAssignment.Expression property equal to.

Returns
Type Description
System.Linq.Expressions.MemberAssignment

A System.Linq.Expressions.MemberAssignment that has System.Linq.Expressions.MemberBinding.BindingType equal to System.Linq.Expressions.MemberBindingType.Assignment and the System.Linq.Expressions.MemberBinding.Member and System.Linq.Expressions.MemberAssignment.Expression properties set to the specified values.

Bind(MethodInfo, Expression)

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

Declaration
public static MemberAssignment Bind(MethodInfo propertyAccessor, Expression expression)
Parameters
Type Name Description
System.Reflection.MethodInfo propertyAccessor

A System.Reflection.MethodInfo that represents a property accessor method.

System.Linq.Expressions.Expression expression

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.MemberAssignment.Expression property equal to.

Returns
Type Description
System.Linq.Expressions.MemberAssignment

A System.Linq.Expressions.MemberAssignment that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.Assignment, the System.Linq.Expressions.MemberBinding.Member property set to the System.Reflection.PropertyInfo that represents the property accessed in propertyAccessor, and the System.Linq.Expressions.MemberAssignment.Expression property set to expression.

Call(Expression, MethodInfo)

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

Declaration
public static MethodCallExpression Call(Expression instance, MethodInfo method)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

An System.Linq.Expressions.Expression that specifies the instance for an instance method call (pass null for a static (Shared in Visual Basic) method).

System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

Call(Expression, MethodInfo, IEnumerable<Expression>)

Creates a System.Linq.Expressions.MethodCallExpression that represents a call to a method that takes arguments.

Declaration
public static MethodCallExpression Call(Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.MethodCallExpression.Object property equal to (pass null for a static (Shared in Visual Basic) method).

System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.MethodCallExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object, System.Linq.Expressions.MethodCallExpression.Method, and System.Linq.Expressions.MethodCallExpression.Arguments properties set to the specified values.

Call(Expression, MethodInfo, Expression, Expression)

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

Declaration
public static MethodCallExpression Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

An System.Linq.Expressions.Expression that specifies the instance for an instance call. (pass null for a static (Shared in Visual Basic) method).

System.Reflection.MethodInfo method

The System.Reflection.MethodInfo that represents the target method.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

System.Linq.Expressions.Expression arg1

The System.Linq.Expressions.Expression that represents the second argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

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

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

Declaration
public static MethodCallExpression Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1, Expression arg2)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

An System.Linq.Expressions.Expression that specifies the instance for an instance call. (pass null for a static (Shared in Visual Basic) method).

System.Reflection.MethodInfo method

The System.Reflection.MethodInfo that represents the target method.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

System.Linq.Expressions.Expression arg1

The System.Linq.Expressions.Expression that represents the second argument.

System.Linq.Expressions.Expression arg2

The System.Linq.Expressions.Expression that represents the third argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

Call(Expression, MethodInfo, Expression[])

Creates a System.Linq.Expressions.MethodCallExpression that represents a call to a method that takes arguments.

Declaration
public static MethodCallExpression Call(Expression instance, MethodInfo method, Expression[] arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

An System.Linq.Expressions.Expression that specifies the instance fo an instance method call (pass null for a static (Shared in Visual Basic) method).

System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression[] arguments

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.MethodCallExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object, System.Linq.Expressions.MethodCallExpression.Method, and System.Linq.Expressions.MethodCallExpression.Arguments properties set to the specified values.

Call(MethodInfo, IEnumerable<Expression>)

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

Declaration
public static MethodCallExpression Call(MethodInfo method, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Reflection.MethodInfo method

The System.Reflection.MethodInfo that represents the target method.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

A collection of System.Linq.Expressions.Expression that represents the call arguments.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

Call(MethodInfo, Expression)

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

Declaration
public static MethodCallExpression Call(MethodInfo method, Expression arg0)
Parameters
Type Name Description
System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

Call(MethodInfo, Expression, Expression)

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

Declaration
public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1)
Parameters
Type Name Description
System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

System.Linq.Expressions.Expression arg1

The System.Linq.Expressions.Expression that represents the second argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

Call(MethodInfo, Expression, Expression, Expression)

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

Declaration
public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2)
Parameters
Type Name Description
System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

System.Linq.Expressions.Expression arg1

The System.Linq.Expressions.Expression that represents the second argument.

System.Linq.Expressions.Expression arg2

The System.Linq.Expressions.Expression that represents the third argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

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

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

Declaration
public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Parameters
Type Name Description
System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

System.Linq.Expressions.Expression arg1

The System.Linq.Expressions.Expression that represents the second argument.

System.Linq.Expressions.Expression arg2

The System.Linq.Expressions.Expression that represents the third argument.

System.Linq.Expressions.Expression arg3

The System.Linq.Expressions.Expression that represents the fourth argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

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

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

Declaration
public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4)
Parameters
Type Name Description
System.Reflection.MethodInfo method

A System.Reflection.MethodInfo to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression arg0

The System.Linq.Expressions.Expression that represents the first argument.

System.Linq.Expressions.Expression arg1

The System.Linq.Expressions.Expression that represents the second argument.

System.Linq.Expressions.Expression arg2

The System.Linq.Expressions.Expression that represents the third argument.

System.Linq.Expressions.Expression arg3

The System.Linq.Expressions.Expression that represents the fourth argument.

System.Linq.Expressions.Expression arg4

The System.Linq.Expressions.Expression that represents the fifth argument.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Object and System.Linq.Expressions.MethodCallExpression.Method properties set to the specified values.

Call(MethodInfo, Expression[])

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

Declaration
public static MethodCallExpression Call(MethodInfo method, Expression[] arguments)
Parameters
Type Name Description
System.Reflection.MethodInfo method

A System.Reflection.MethodInfo that represents a static (Shared in Visual Basic) method to set the System.Linq.Expressions.MethodCallExpression.Method property equal to.

System.Linq.Expressions.Expression[] arguments

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.MethodCallExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.MethodCallExpression

A System.Linq.Expressions.MethodCallExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Call and the System.Linq.Expressions.MethodCallExpression.Method and System.Linq.Expressions.MethodCallExpression.Arguments properties set to the specified values.

Condition(Expression, Expression, Expression)

Creates a System.Linq.Expressions.ConditionalExpression that represents a conditional statement.

Declaration
public static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse)
Parameters
Type Name Description
System.Linq.Expressions.Expression test

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.Test property equal to.

System.Linq.Expressions.Expression ifTrue

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfTrue property equal to.

System.Linq.Expressions.Expression ifFalse

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfFalse property equal to.

Returns
Type Description
System.Linq.Expressions.ConditionalExpression

A System.Linq.Expressions.ConditionalExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Conditional and the System.Linq.Expressions.ConditionalExpression.Test, System.Linq.Expressions.ConditionalExpression.IfTrue, and System.Linq.Expressions.ConditionalExpression.IfFalse properties set to the specified values.

Condition(Expression, Expression, Expression, Type)

Creates a System.Linq.Expressions.ConditionalExpression that represents a conditional statement.

Declaration
public static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse, Type type)
Parameters
Type Name Description
System.Linq.Expressions.Expression test

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.Test property equal to.

System.Linq.Expressions.Expression ifTrue

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfTrue property equal to.

System.Linq.Expressions.Expression ifFalse

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfFalse property equal to.

System.Type type

A System.Linq.Expressions.Expression.Type to set the System.Linq.Expressions.Expression.Type property equal to.

Returns
Type Description
System.Linq.Expressions.ConditionalExpression

A System.Linq.Expressions.ConditionalExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Conditional and the System.Linq.Expressions.ConditionalExpression.Test, System.Linq.Expressions.ConditionalExpression.IfTrue, and System.Linq.Expressions.ConditionalExpression.IfFalse properties set to the specified values.

ElementInit(MethodInfo, IEnumerable<Expression>)

Creates an System.Linq.Expressions.ElementInit, given an System.Collections.Generic.IEnumerable<> as the second argument.

Declaration
public static ElementInit ElementInit(MethodInfo addMethod, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Reflection.MethodInfo addMethod

A System.Reflection.MethodInfo to set the System.Linq.Expressions.ElementInit.AddMethod property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to set the System.Linq.Expressions.ElementInit.Arguments property equal to.

Returns
Type Description
System.Linq.Expressions.ElementInit

An System.Linq.Expressions.ElementInit that has the System.Linq.Expressions.ElementInit.AddMethod and System.Linq.Expressions.ElementInit.Arguments properties set to the specified values.

ElementInit(MethodInfo, Expression[])

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

Declaration
public static ElementInit ElementInit(MethodInfo addMethod, Expression[] arguments)
Parameters
Type Name Description
System.Reflection.MethodInfo addMethod

A System.Reflection.MethodInfo to set the System.Linq.Expressions.ElementInit.AddMethod property equal to.

System.Linq.Expressions.Expression[] arguments

An array of System.Linq.Expressions.Expression objects to set the System.Linq.Expressions.ElementInit.Arguments property equal to.

Returns
Type Description
System.Linq.Expressions.ElementInit

An System.Linq.Expressions.ElementInit that has the System.Linq.Expressions.ElementInit.AddMethod and System.Linq.Expressions.ElementInit.Arguments properties set to the specified values.

IfThen(Expression, Expression)

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

Declaration
public static ConditionalExpression IfThen(Expression test, Expression ifTrue)
Parameters
Type Name Description
System.Linq.Expressions.Expression test

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.Test property equal to.

System.Linq.Expressions.Expression ifTrue

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfTrue property equal to.

Returns
Type Description
System.Linq.Expressions.ConditionalExpression

A System.Linq.Expressions.ConditionalExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Conditional and the System.Linq.Expressions.ConditionalExpression.Test, System.Linq.Expressions.ConditionalExpression.IfTrue, properties set to the specified values. The System.Linq.Expressions.ConditionalExpression.IfFalse property is set to default expression and the type of the resulting System.Linq.Expressions.ConditionalExpression returned by this method is System.Void.

IfThenElse(Expression, Expression, Expression)

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

Declaration
public static ConditionalExpression IfThenElse(Expression test, Expression ifTrue, Expression ifFalse)
Parameters
Type Name Description
System.Linq.Expressions.Expression test

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.Test property equal to.

System.Linq.Expressions.Expression ifTrue

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfTrue property equal to.

System.Linq.Expressions.Expression ifFalse

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.ConditionalExpression.IfFalse property equal to.

Returns
Type Description
System.Linq.Expressions.ConditionalExpression

A System.Linq.Expressions.ConditionalExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Conditional and the System.Linq.Expressions.ConditionalExpression.Test, System.Linq.Expressions.ConditionalExpression.IfTrue, and System.Linq.Expressions.ConditionalExpression.IfFalse properties set to the specified values. The type of the resulting System.Linq.Expressions.ConditionalExpression returned by this method is System.Void.

Invoke(Expression, IEnumerable<Expression>)

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

Declaration
public static InvocationExpression Invoke(Expression expression, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

An System.Linq.Expressions.Expression that represents the delegate or lambda expression to be applied to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects that represent the arguments that the delegate or lambda expression is applied to.

Returns
Type Description
System.Linq.Expressions.InvocationExpression

An System.Linq.Expressions.InvocationExpression that applies the specified delegate or lambda expression to the provided arguments.

Invoke(Expression, Expression[])

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

Declaration
public static InvocationExpression Invoke(Expression expression, Expression[] arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

An System.Linq.Expressions.Expression that represents the delegate or lambda expression to be applied.

System.Linq.Expressions.Expression[] arguments

An array of System.Linq.Expressions.Expression objects that represent the arguments that the delegate or lambda expression is applied to.

Returns
Type Description
System.Linq.Expressions.InvocationExpression

An System.Linq.Expressions.InvocationExpression that applies the specified delegate or lambda expression to the provided arguments.

Lambda(Expression, Boolean, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Expression body, bool tailCall, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Lambda(Expression, Boolean, ParameterExpression[])

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Expression body, bool tailCall, ParameterExpression[] parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Linq.Expressions.ParameterExpression[] parameters

An array that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Lambda(Expression, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Expression body, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Lambda(Expression, ParameterExpression[])

Creates a System.Linq.Expressions.LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Expression body, ParameterExpression[] parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Linq.Expressions.ParameterExpression[] parameters

An array of System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

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

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Expression body, string name, bool tailCall, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.String name

The name for the lambda. Used for emitting debug information.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Lambda(Expression, String, IEnumerable<ParameterExpression>)

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Expression body, string name, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.String name

The name for the lambda. Used for emitting debug information.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

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

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Type delegateType

A System.Linq.Expressions.Expression.Type representing the delegate signature for the lambda.

System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

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

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, ParameterExpression[] parameters)
Parameters
Type Name Description
System.Type delegateType

A System.Linq.Expressions.Expression.Type representing the delegate signature for the lambda.

System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Linq.Expressions.ParameterExpression[] parameters

An array that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Lambda(Type, Expression, IEnumerable<ParameterExpression>)

Creates a System.Linq.Expressions.LambdaExpression by first constructing a delegate type. It can be used when the delegate type is not known at compile time.

Declaration
public static LambdaExpression Lambda(Type delegateType, Expression body, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Type delegateType

A System.Type that represents a delegate signature for the lambda.

System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

An object that represents a lambda expression which has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Lambda(Type, Expression, ParameterExpression[])

Creates a System.Linq.Expressions.LambdaExpression by first constructing a delegate type. It can be used when the delegate type is not known at compile time.

Declaration
public static LambdaExpression Lambda(Type delegateType, Expression body, ParameterExpression[] parameters)
Parameters
Type Name Description
System.Type delegateType

A System.Type that represents a delegate signature for the lambda.

System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Linq.Expressions.ParameterExpression[] parameters

An array of System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

An object that represents a lambda expression which has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

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

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Type delegateType, Expression body, string name, bool tailCall, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Type delegateType

A System.Linq.Expressions.Expression.Type representing the delegate signature for the lambda.

System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.String name

The name for the lambda. Used for emitting debug information.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

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

Creates a LambdaExpression by first constructing a delegate type.

Declaration
public static LambdaExpression Lambda(Type delegateType, Expression body, string name, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Type delegateType

A System.Linq.Expressions.Expression.Type representing the delegate signature for the lambda.

System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.String name

The name for the lambda. Used for emitting debug information.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.LambdaExpression

A System.Linq.Expressions.LambdaExpression that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

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

Creates an System.Linq.Expressions.Expression<> where the delegate type is known at compile time.

Declaration
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, bool tailCall, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.Expression<TDelegate>

An System.Linq.Expressions.Expression<> that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambdaand the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Type Parameters
Name Description
TDelegate

The delegate type.

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

Creates an System.Linq.Expressions.Expression<> where the delegate type is known at compile time.

Declaration
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, bool tailCall, ParameterExpression[] parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Linq.Expressions.ParameterExpression[] parameters

An array that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.Expression<TDelegate>

An System.Linq.Expressions.Expression<> that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Type Parameters
Name Description
TDelegate

The delegate type.

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

Creates an System.Linq.Expressions.Expression<> where the delegate type is known at compile time.

Declaration
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.Expression<TDelegate>

An System.Linq.Expressions.Expression<> that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Type Parameters
Name Description
TDelegate

A delegate type.

Lambda<TDelegate>(Expression, ParameterExpression[])

Creates an System.Linq.Expressions.Expression<> where the delegate type is known at compile time.

Declaration
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, ParameterExpression[] parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.Linq.Expressions.ParameterExpression[] parameters

An array of System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.Expression<TDelegate>

An System.Linq.Expressions.Expression<> that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Type Parameters
Name Description
TDelegate

A delegate type.

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

Creates an System.Linq.Expressions.Expression<> where the delegate type is known at compile time.

Declaration
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, string name, bool tailCall, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.String name

The name of the lambda. Used for generating debugging info.

System.Boolean tailCall

A System.Boolean that indicates if tail call optimization will be applied when compiling the created expression.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.Expression<TDelegate>

An System.Linq.Expressions.Expression<> that has the System.Linq.Expressions.LambdaExpression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Type Parameters
Name Description
TDelegate

The delegate type.

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

Creates an System.Linq.Expressions.Expression<> where the delegate type is known at compile time.

Declaration
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, string name, IEnumerable<ParameterExpression> parameters)
Parameters
Type Name Description
System.Linq.Expressions.Expression body

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.LambdaExpression.Body property equal to.

System.String name

The name of the lambda. Used for generating debugging information.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> parameters

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ParameterExpression objects to use to populate the System.Linq.Expressions.LambdaExpression.Parameters collection.

Returns
Type Description
System.Linq.Expressions.Expression<TDelegate>

An System.Linq.Expressions.Expression<> that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.Lambda and the System.Linq.Expressions.LambdaExpression.Body and System.Linq.Expressions.LambdaExpression.Parameters properties set to the specified values.

Type Parameters
Name Description
TDelegate

The delegate type.

ListBind(MemberInfo, IEnumerable<ElementInit>)

Creates a System.Linq.Expressions.MemberListBinding where the member is a field or property.

Declaration
public static MemberListBinding ListBind(MemberInfo member, IEnumerable<ElementInit> initializers)
Parameters
Type Name Description
System.Reflection.MemberInfo member

A System.Reflection.MemberInfo that represents a field or property to set the System.Linq.Expressions.MemberBinding.Member property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ElementInit> initializers

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ElementInit objects to use to populate the System.Linq.Expressions.MemberListBinding.Initializers collection.

Returns
Type Description
System.Linq.Expressions.MemberListBinding

A System.Linq.Expressions.MemberListBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.ListBinding and the System.Linq.Expressions.MemberBinding.Member and System.Linq.Expressions.MemberListBinding.Initializers properties set to the specified values.

ListBind(MemberInfo, ElementInit[])

Creates a System.Linq.Expressions.MemberListBinding where the member is a field or property.

Declaration
public static MemberListBinding ListBind(MemberInfo member, ElementInit[] initializers)
Parameters
Type Name Description
System.Reflection.MemberInfo member

A System.Reflection.MemberInfo that represents a field or property to set the System.Linq.Expressions.MemberBinding.Member property equal to.

System.Linq.Expressions.ElementInit[] initializers

An array of System.Linq.Expressions.ElementInit objects to use to populate the System.Linq.Expressions.MemberListBinding.Initializers collection.

Returns
Type Description
System.Linq.Expressions.MemberListBinding

A System.Linq.Expressions.MemberListBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.ListBinding and the System.Linq.Expressions.MemberBinding.Member and System.Linq.Expressions.MemberListBinding.Initializers properties set to the specified values.

ListBind(MethodInfo, IEnumerable<ElementInit>)

Creates a System.Linq.Expressions.MemberListBinding based on a specified property accessor method.

Declaration
public static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers)
Parameters
Type Name Description
System.Reflection.MethodInfo propertyAccessor

A System.Reflection.MethodInfo that represents a property accessor method.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ElementInit> initializers

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ElementInit objects to use to populate the System.Linq.Expressions.MemberListBinding.Initializers collection.

Returns
Type Description
System.Linq.Expressions.MemberListBinding

A System.Linq.Expressions.MemberListBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.ListBinding, the System.Linq.Expressions.MemberBinding.Member property set to the System.Reflection.MemberInfo that represents the property accessed in propertyAccessor, and System.Linq.Expressions.MemberListBinding.Initializers populated with the elements of initializers.

ListBind(MethodInfo, ElementInit[])

Creates a System.Linq.Expressions.MemberListBinding object based on a specified property accessor method.

Declaration
public static MemberListBinding ListBind(MethodInfo propertyAccessor, ElementInit[] initializers)
Parameters
Type Name Description
System.Reflection.MethodInfo propertyAccessor

A System.Reflection.MethodInfo that represents a property accessor method.

System.Linq.Expressions.ElementInit[] initializers

An array of System.Linq.Expressions.ElementInit objects to use to populate the System.Linq.Expressions.MemberListBinding.Initializers collection.

Returns
Type Description
System.Linq.Expressions.MemberListBinding

A System.Linq.Expressions.MemberListBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.ListBinding, the System.Linq.Expressions.MemberBinding.Member property set to the System.Reflection.MemberInfo that represents the property accessed in propertyAccessor, and System.Linq.Expressions.MemberListBinding.Initializers populated with the elements of initializers.

ListInit(NewExpression, IEnumerable<ElementInit>)

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

Declaration
public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable<ElementInit> initializers)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression newExpression

A System.Linq.Expressions.NewExpression to set the System.Linq.Expressions.ListInitExpression.NewExpression property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.ElementInit> initializers

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.ElementInit objects to use to populate the System.Linq.Expressions.ListInitExpression.Initializers collection.

Returns
Type Description
System.Linq.Expressions.ListInitExpression

A System.Linq.Expressions.ListInitExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.ListInit and the System.Linq.Expressions.ListInitExpression.NewExpression and System.Linq.Expressions.ListInitExpression.Initializers properties set to the specified values.

ListInit(NewExpression, ElementInit[])

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

Declaration
public static ListInitExpression ListInit(NewExpression newExpression, ElementInit[] initializers)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression newExpression

A System.Linq.Expressions.NewExpression to set the System.Linq.Expressions.ListInitExpression.NewExpression property equal to.

System.Linq.Expressions.ElementInit[] initializers

An array of System.Linq.Expressions.ElementInit objects to use to populate the System.Linq.Expressions.ListInitExpression.Initializers collection.

Returns
Type Description
System.Linq.Expressions.ListInitExpression

A System.Linq.Expressions.ListInitExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.ListInit and the System.Linq.Expressions.ListInitExpression.NewExpression and System.Linq.Expressions.ListInitExpression.Initializers properties set to the specified values.

ListInit(NewExpression, MethodInfo, IEnumerable<Expression>)

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

Declaration
public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, IEnumerable<Expression> initializers)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression newExpression

A System.Linq.Expressions.NewExpression to set the System.Linq.Expressions.ListInitExpression.NewExpression property equal to.

System.Reflection.MethodInfo addMethod

A System.Reflection.MethodInfo that represents an instance method named "Add" (case insensitive), that adds an element to a collection.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> initializers

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.ListInitExpression.Initializers collection.

Returns
Type Description
System.Linq.Expressions.ListInitExpression

A System.Linq.Expressions.ListInitExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.ListInit and the System.Linq.Expressions.ListInitExpression.NewExpression property set to the specified value.

ListInit(NewExpression, MethodInfo, Expression[])

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

Declaration
public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, Expression[] initializers)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression newExpression

A System.Linq.Expressions.NewExpression to set the System.Linq.Expressions.ListInitExpression.NewExpression property equal to.

System.Reflection.MethodInfo addMethod

A System.Reflection.MethodInfo that represents an instance method that takes one argument, that adds an element to a collection.

System.Linq.Expressions.Expression[] initializers

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.ListInitExpression.Initializers collection.

Returns
Type Description
System.Linq.Expressions.ListInitExpression

A System.Linq.Expressions.ListInitExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.ListInit and the System.Linq.Expressions.ListInitExpression.NewExpression property set to the specified value.

MakeBinary(ExpressionType, Expression, Expression)

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

Declaration
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right)
Parameters
Type Name Description
System.Linq.Expressions.ExpressionType binaryType

The System.Linq.Expressions.ExpressionType that specifies the type of binary operation.

System.Linq.Expressions.Expression left

An System.Linq.Expressions.Expression that represents the left operand.

System.Linq.Expressions.Expression right

An System.Linq.Expressions.Expression that represents the right operand.

Returns
Type Description
System.Linq.Expressions.BinaryExpression

The System.Linq.Expressions.BinaryExpression that results from calling the appropriate factory method.

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

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

Declaration
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
Parameters
Type Name Description
System.Linq.Expressions.ExpressionType binaryType

The System.Linq.Expressions.ExpressionType that specifies the type of binary operation.

System.Linq.Expressions.Expression left

An System.Linq.Expressions.Expression that represents the left operand.

System.Linq.Expressions.Expression right

An System.Linq.Expressions.Expression that represents the right operand.

System.Boolean liftToNull

true to set IsLiftedToNull to true; false to set IsLiftedToNull to false.

System.Reflection.MethodInfo method

A System.Reflection.MethodInfo that specifies the implementing method.

Returns
Type Description
System.Linq.Expressions.BinaryExpression

The System.Linq.Expressions.BinaryExpression that results from calling the appropriate factory method.

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

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

Declaration
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
Parameters
Type Name Description
System.Linq.Expressions.ExpressionType binaryType

The System.Linq.Expressions.ExpressionType that specifies the type of binary operation.

System.Linq.Expressions.Expression left

An System.Linq.Expressions.Expression that represents the left operand.

System.Linq.Expressions.Expression right

An System.Linq.Expressions.Expression that represents the right operand.

System.Boolean liftToNull

true to set IsLiftedToNull to true; false to set IsLiftedToNull to false.

System.Reflection.MethodInfo method

A System.Reflection.MethodInfo that specifies the implementing method.

System.Linq.Expressions.LambdaExpression conversion

A System.Linq.Expressions.LambdaExpression that represents a type conversion function. This parameter is used if binaryType is Coalesce or compound assignment.

Returns
Type Description
System.Linq.Expressions.BinaryExpression

The System.Linq.Expressions.BinaryExpression that results from calling the appropriate factory method.

MakeIndex(Expression, PropertyInfo, IEnumerable<Expression>)

Creates an System.Linq.Expressions.IndexExpression that represents accessing an indexed property in an object.

Declaration
public static IndexExpression MakeIndex(Expression instance, PropertyInfo indexer, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

The object to which the property belongs. It should be null if the property is static (shared in Visual Basic).

System.Reflection.PropertyInfo indexer

An System.Linq.Expressions.Expression representing the property to index.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An IEnumerable<Expression> (IEnumerable (Of Expression) in Visual Basic) that contains the arguments that will be used to index the property.

Returns
Type Description
System.Linq.Expressions.IndexExpression

The created System.Linq.Expressions.IndexExpression.

MakeUnary(ExpressionType, Expression, Type)

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

Declaration
public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type)
Parameters
Type Name Description
System.Linq.Expressions.ExpressionType unaryType

The System.Linq.Expressions.ExpressionType that specifies the type of unary operation.

System.Linq.Expressions.Expression operand

An System.Linq.Expressions.Expression that represents the operand.

System.Type type

The System.Type that specifies the type to be converted to (pass null if not applicable).

Returns
Type Description
System.Linq.Expressions.UnaryExpression

The System.Linq.Expressions.UnaryExpression that results from calling the appropriate factory method.

Exceptions
Type Condition
System.ArgumentNullException

operand is null.

System.ArgumentException

unaryType does not correspond to a unary expression node.

MakeUnary(ExpressionType, Expression, Type, MethodInfo)

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

Declaration
public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
Parameters
Type Name Description
System.Linq.Expressions.ExpressionType unaryType

The System.Linq.Expressions.ExpressionType that specifies the type of unary operation.

System.Linq.Expressions.Expression operand

An System.Linq.Expressions.Expression that represents the operand.

System.Type type

The System.Type that specifies the type to be converted to (pass null if not applicable).

System.Reflection.MethodInfo method

The System.Reflection.MethodInfo that represents the implementing method.

Returns
Type Description
System.Linq.Expressions.UnaryExpression

The System.Linq.Expressions.UnaryExpression that results from calling the appropriate factory method.

Exceptions
Type Condition
System.ArgumentNullException

operand is null.

System.ArgumentException

unaryType does not correspond to a unary expression node.

MemberBind(MemberInfo, IEnumerable<MemberBinding>)

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

Declaration
public static MemberMemberBinding MemberBind(MemberInfo member, IEnumerable<MemberBinding> bindings)
Parameters
Type Name Description
System.Reflection.MemberInfo member

The System.Reflection.MemberInfo to set the System.Linq.Expressions.MemberBinding.Member property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.MemberBinding> bindings

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.MemberBinding objects to use to populate the System.Linq.Expressions.MemberMemberBinding.Bindings collection.

Returns
Type Description
System.Linq.Expressions.MemberMemberBinding

A System.Linq.Expressions.MemberMemberBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.MemberBinding and the System.Linq.Expressions.MemberBinding.Member and System.Linq.Expressions.MemberMemberBinding.Bindings properties set to the specified values.

MemberBind(MemberInfo, MemberBinding[])

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

Declaration
public static MemberMemberBinding MemberBind(MemberInfo member, MemberBinding[] bindings)
Parameters
Type Name Description
System.Reflection.MemberInfo member

The System.Reflection.MemberInfo to set the System.Linq.Expressions.MemberBinding.Member property equal to.

System.Linq.Expressions.MemberBinding[] bindings

An array of System.Linq.Expressions.MemberBinding objects to use to populate the System.Linq.Expressions.MemberMemberBinding.Bindings collection.

Returns
Type Description
System.Linq.Expressions.MemberMemberBinding

A System.Linq.Expressions.MemberMemberBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.MemberBinding and the System.Linq.Expressions.MemberBinding.Member and System.Linq.Expressions.MemberMemberBinding.Bindings properties set to the specified values.

MemberBind(MethodInfo, IEnumerable<MemberBinding>)

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

Declaration
public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, IEnumerable<MemberBinding> bindings)
Parameters
Type Name Description
System.Reflection.MethodInfo propertyAccessor

The System.Reflection.MethodInfo that represents a property accessor method.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.MemberBinding> bindings

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.MemberBinding objects to use to populate the System.Linq.Expressions.MemberMemberBinding.Bindings collection.

Returns
Type Description
System.Linq.Expressions.MemberMemberBinding

A System.Linq.Expressions.MemberMemberBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.MemberBinding, the System.Linq.Expressions.MemberBinding.Member property set to the System.Reflection.PropertyInfo that represents the property accessed in propertyAccessor, and System.Linq.Expressions.MemberMemberBinding.Bindings properties set to the specified values.

MemberBind(MethodInfo, MemberBinding[])

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

Declaration
public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, MemberBinding[] bindings)
Parameters
Type Name Description
System.Reflection.MethodInfo propertyAccessor

The System.Reflection.MethodInfo that represents a property accessor method.

System.Linq.Expressions.MemberBinding[] bindings

An array of System.Linq.Expressions.MemberBinding objects to use to populate the System.Linq.Expressions.MemberMemberBinding.Bindings collection.

Returns
Type Description
System.Linq.Expressions.MemberMemberBinding

A System.Linq.Expressions.MemberMemberBinding that has the System.Linq.Expressions.MemberBinding.BindingType property equal to System.Linq.Expressions.MemberBindingType.MemberBinding, the System.Linq.Expressions.MemberBinding.Member property set to the System.Reflection.PropertyInfo that represents the property accessed in propertyAccessor, and System.Linq.Expressions.MemberMemberBinding.Bindings properties set to the specified values.

MemberInit(NewExpression, IEnumerable<MemberBinding>)

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

Declaration
public static MemberInitExpression MemberInit(NewExpression newExpression, IEnumerable<MemberBinding> bindings)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression newExpression

A System.Linq.Expressions.NewExpression to set the System.Linq.Expressions.MemberInitExpression.NewExpression property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.MemberBinding> bindings

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.MemberBinding objects to use to populate the System.Linq.Expressions.MemberInitExpression.Bindings collection.

Returns
Type Description
System.Linq.Expressions.MemberInitExpression

A System.Linq.Expressions.MemberInitExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.MemberInit and the System.Linq.Expressions.MemberInitExpression.NewExpression and System.Linq.Expressions.MemberInitExpression.Bindings properties set to the specified values.

MemberInit(NewExpression, MemberBinding[])

Creates a System.Linq.Expressions.MemberInitExpression.

Declaration
public static MemberInitExpression MemberInit(NewExpression newExpression, MemberBinding[] bindings)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression newExpression

A System.Linq.Expressions.NewExpression to set the System.Linq.Expressions.MemberInitExpression.NewExpression property equal to.

System.Linq.Expressions.MemberBinding[] bindings

An array of System.Linq.Expressions.MemberBinding objects to use to populate the System.Linq.Expressions.MemberInitExpression.Bindings collection.

Returns
Type Description
System.Linq.Expressions.MemberInitExpression

A System.Linq.Expressions.MemberInitExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.MemberInit and the System.Linq.Expressions.MemberInitExpression.NewExpression and System.Linq.Expressions.MemberInitExpression.Bindings properties set to the specified values.

New(ConstructorInfo)

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

Declaration
public static NewExpression New(ConstructorInfo constructor)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor

The System.Reflection.ConstructorInfo to set the System.Linq.Expressions.NewExpression.Constructor property equal to.

Returns
Type Description
System.Linq.Expressions.NewExpression

A System.Linq.Expressions.NewExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.New and the System.Linq.Expressions.NewExpression.Constructor property set to the specified value.

New(ConstructorInfo, IEnumerable<Expression>)

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

Declaration
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor

The System.Reflection.ConstructorInfo to set the System.Linq.Expressions.NewExpression.Constructor property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.NewExpression

A System.Linq.Expressions.NewExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.New and the System.Linq.Expressions.NewExpression.Constructor and System.Linq.Expressions.NewExpression.Arguments properties set to the specified values.

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

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

Declaration
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor

The System.Reflection.ConstructorInfo to set the System.Linq.Expressions.NewExpression.Constructor property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewExpression.Arguments collection.

System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo> members

An System.Collections.Generic.IEnumerable<> that contains System.Reflection.MemberInfo objects to use to populate the System.Linq.Expressions.NewExpression.Members collection.

Returns
Type Description
System.Linq.Expressions.NewExpression

A System.Linq.Expressions.NewExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.New and the System.Linq.Expressions.NewExpression.Constructor, System.Linq.Expressions.NewExpression.Arguments and System.Linq.Expressions.NewExpression.Members properties set to the specified values.

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

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

Declaration
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, MemberInfo[] members)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor

The System.Reflection.ConstructorInfo to set the System.Linq.Expressions.NewExpression.Constructor property equal to.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewExpression.Arguments collection.

System.Reflection.MemberInfo[] members

An array of System.Reflection.MemberInfo objects to use to populate the System.Linq.Expressions.NewExpression.Members collection.

Returns
Type Description
System.Linq.Expressions.NewExpression

A System.Linq.Expressions.NewExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.New and the System.Linq.Expressions.NewExpression.Constructor, System.Linq.Expressions.NewExpression.Arguments and System.Linq.Expressions.NewExpression.Members properties set to the specified values.

New(ConstructorInfo, Expression[])

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

Declaration
public static NewExpression New(ConstructorInfo constructor, Expression[] arguments)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor

The System.Reflection.ConstructorInfo to set the System.Linq.Expressions.NewExpression.Constructor property equal to.

System.Linq.Expressions.Expression[] arguments

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewExpression.Arguments collection.

Returns
Type Description
System.Linq.Expressions.NewExpression

A System.Linq.Expressions.NewExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.New and the System.Linq.Expressions.NewExpression.Constructor and System.Linq.Expressions.NewExpression.Arguments properties set to the specified values.

NewArrayBounds(Type, IEnumerable<Expression>)

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

Declaration
public static NewArrayExpression NewArrayBounds(Type type, IEnumerable<Expression> bounds)
Parameters
Type Name Description
System.Type type

A System.Type that represents the element type of the array.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> bounds

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewArrayExpression.Expressions collection.

Returns
Type Description
System.Linq.Expressions.NewArrayExpression

A System.Linq.Expressions.NewArrayExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.NewArrayBounds and the System.Linq.Expressions.NewArrayExpression.Expressions property set to the specified value.

NewArrayBounds(Type, Expression[])

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

Declaration
public static NewArrayExpression NewArrayBounds(Type type, Expression[] bounds)
Parameters
Type Name Description
System.Type type

A System.Type that represents the element type of the array.

System.Linq.Expressions.Expression[] bounds

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewArrayExpression.Expressions collection.

Returns
Type Description
System.Linq.Expressions.NewArrayExpression

A System.Linq.Expressions.NewArrayExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.NewArrayBounds and the System.Linq.Expressions.NewArrayExpression.Expressions property set to the specified value.

NewArrayInit(Type, IEnumerable<Expression>)

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

Declaration
public static NewArrayExpression NewArrayInit(Type type, IEnumerable<Expression> initializers)
Parameters
Type Name Description
System.Type type

A System.Type that represents the element type of the array.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> initializers

An System.Collections.Generic.IEnumerable<> that contains System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewArrayExpression.Expressions collection.

Returns
Type Description
System.Linq.Expressions.NewArrayExpression

A System.Linq.Expressions.NewArrayExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.NewArrayInit and the System.Linq.Expressions.NewArrayExpression.Expressions property set to the specified value.

NewArrayInit(Type, Expression[])

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

Declaration
public static NewArrayExpression NewArrayInit(Type type, Expression[] initializers)
Parameters
Type Name Description
System.Type type

A System.Type that represents the element type of the array.

System.Linq.Expressions.Expression[] initializers

An array of System.Linq.Expressions.Expression objects to use to populate the System.Linq.Expressions.NewArrayExpression.Expressions collection.

Returns
Type Description
System.Linq.Expressions.NewArrayExpression

A System.Linq.Expressions.NewArrayExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.NewArrayInit and the System.Linq.Expressions.NewArrayExpression.Expressions property set to the specified value.

Property(Expression, PropertyInfo, IEnumerable<Expression>)

Creates an System.Linq.Expressions.IndexExpression representing the access to an indexed property.

Declaration
public static IndexExpression Property(Expression instance, PropertyInfo indexer, IEnumerable<Expression> arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

The object to which the property belongs. If the property is static/shared, it must be null.

System.Reflection.PropertyInfo indexer

The System.Reflection.PropertyInfo that represents the property to index.

System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments

An System.Collections.Generic.IEnumerable<> of System.Linq.Expressions.Expression objects that are used to index the property.

Returns
Type Description
System.Linq.Expressions.IndexExpression

The created System.Linq.Expressions.IndexExpression.

Property(Expression, PropertyInfo, Expression[])

Creates an System.Linq.Expressions.IndexExpression representing the access to an indexed property.

Declaration
public static IndexExpression Property(Expression instance, PropertyInfo indexer, Expression[] arguments)
Parameters
Type Name Description
System.Linq.Expressions.Expression instance

The object to which the property belongs. If the property is static/shared, it must be null.

System.Reflection.PropertyInfo indexer

The System.Reflection.PropertyInfo that represents the property to index.

System.Linq.Expressions.Expression[] arguments

An array of System.Linq.Expressions.Expression objects that are used to index the property.

Returns
Type Description
System.Linq.Expressions.IndexExpression

The created System.Linq.Expressions.IndexExpression.

TypeAs(Expression, Type)

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

Declaration
public static UnaryExpression TypeAs(Expression expression, Type type)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

An System.Linq.Expressions.Expression to set the System.Linq.Expressions.UnaryExpression.Operand property equal to.

System.Type type

A System.Type to set the System.Linq.Expressions.Expression.Type property equal to.

Returns
Type Description
System.Linq.Expressions.UnaryExpression

A System.Linq.Expressions.UnaryExpression that has the System.Linq.Expressions.Expression.NodeType property equal to System.Linq.Expressions.ExpressionType.TypeAs and the System.Linq.Expressions.UnaryExpression.Operand and System.Linq.Expressions.Expression.Type properties set to the specified values.

Exceptions
Type Condition
System.ArgumentNullException

expression or type is null.

Unbox(Expression, Type)

Creates a System.Linq.Expressions.UnaryExpression that represents an explicit unboxing.

Declaration
public static UnaryExpression Unbox(Expression expression, Type type)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

An System.Linq.Expressions.Expression to unbox.

System.Type type

The new System.Type of the expression.

Returns
Type Description
System.Linq.Expressions.UnaryExpression

An instance of System.Linq.Expressions.UnaryExpression.

In This Article
Back to top Generated by DocFX