Expression.MakeBinary Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a BinaryExpression by calling the appropriate factory method.
Overloads
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. |
MakeBinary(ExpressionType, Expression, Expression)
- Source:
- BinaryExpression.cs
- Source:
- BinaryExpression.cs
- Source:
- BinaryExpression.cs
Creates a BinaryExpression, given the left and right operands, by calling an appropriate factory method.
public:
static System::Linq::Expressions::BinaryExpression ^ MakeBinary(System::Linq::Expressions::ExpressionType binaryType, System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right);
public static System.Linq.Expressions.BinaryExpression MakeBinary (System.Linq.Expressions.ExpressionType binaryType, System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right);
static member MakeBinary : System.Linq.Expressions.ExpressionType * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.BinaryExpression
Public Shared Function MakeBinary (binaryType As ExpressionType, left As Expression, right As Expression) As BinaryExpression
Parameters
- binaryType
- ExpressionType
The ExpressionType that specifies the type of binary operation.
- left
- Expression
An Expression that represents the left operand.
- right
- Expression
An Expression that represents the right operand.
Returns
The BinaryExpression that results from calling the appropriate factory method.
Exceptions
binaryType
does not correspond to a binary expression node.
left
or right
is null
.
Examples
The following example demonstrates how to use the MakeBinary(ExpressionType, Expression, Expression) method to create a BinaryExpression that represents the subtraction of one number from another.
// Create a BinaryExpression that represents subtracting 14 from 53.
System.Linq.Expressions.BinaryExpression binaryExpression =
System.Linq.Expressions.Expression.MakeBinary(
System.Linq.Expressions.ExpressionType.Subtract,
System.Linq.Expressions.Expression.Constant(53),
System.Linq.Expressions.Expression.Constant(14));
Console.WriteLine(binaryExpression.ToString());
// This code produces the following output:
//
// (53 - 14)
' Create a BinaryExpression that represents subtracting 14 from 53.
Dim binaryExpression As System.Linq.Expressions.BinaryExpression = _
System.Linq.Expressions.Expression.MakeBinary( _
System.Linq.Expressions.ExpressionType.Subtract, _
System.Linq.Expressions.Expression.Constant(53), _
System.Linq.Expressions.Expression.Constant(14))
Console.WriteLine(binaryExpression.ToString())
' This code produces the following output:
'
' (53 - 14)
Remarks
The binaryType
parameter determines which BinaryExpression factory method this method calls. For example, if binaryType
is Subtract, this method invokes Subtract.
Applies to
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo)
- Source:
- BinaryExpression.cs
- Source:
- BinaryExpression.cs
- Source:
- BinaryExpression.cs
Creates a BinaryExpression, given the left operand, right operand and implementing method, by calling the appropriate factory method.
public:
static System::Linq::Expressions::BinaryExpression ^ MakeBinary(System::Linq::Expressions::ExpressionType binaryType, System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right, bool liftToNull, System::Reflection::MethodInfo ^ method);
public static System.Linq.Expressions.BinaryExpression MakeBinary (System.Linq.Expressions.ExpressionType binaryType, System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, bool liftToNull, System.Reflection.MethodInfo method);
public static System.Linq.Expressions.BinaryExpression MakeBinary (System.Linq.Expressions.ExpressionType binaryType, System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, bool liftToNull, System.Reflection.MethodInfo? method);
static member MakeBinary : System.Linq.Expressions.ExpressionType * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * bool * System.Reflection.MethodInfo -> System.Linq.Expressions.BinaryExpression
Public Shared Function MakeBinary (binaryType As ExpressionType, left As Expression, right As Expression, liftToNull As Boolean, method As MethodInfo) As BinaryExpression
Parameters
- binaryType
- ExpressionType
The ExpressionType that specifies the type of binary operation.
- left
- Expression
An Expression that represents the left operand.
- right
- Expression
An Expression that represents the right operand.
- liftToNull
- Boolean
true
to set IsLiftedToNull to true
; false
to set IsLiftedToNull to false
.
- method
- MethodInfo
A MethodInfo that specifies the implementing method.
Returns
The BinaryExpression that results from calling the appropriate factory method.
Exceptions
binaryType
does not correspond to a binary expression node.
left
or right
is null
.
Remarks
The binaryType
parameter determines which BinaryExpression factory method this method will call. For example, if binaryType
is Subtract, this method invokes Subtract. The liftToNull
and method
parameters are ignored if the appropriate factory method does not have a corresponding parameter.
Applies to
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo, LambdaExpression)
- Source:
- BinaryExpression.cs
- Source:
- BinaryExpression.cs
- Source:
- BinaryExpression.cs
Creates a BinaryExpression, given the left operand, right operand, implementing method and type conversion function, by calling the appropriate factory method.
public:
static System::Linq::Expressions::BinaryExpression ^ MakeBinary(System::Linq::Expressions::ExpressionType binaryType, System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right, bool liftToNull, System::Reflection::MethodInfo ^ method, System::Linq::Expressions::LambdaExpression ^ conversion);
public static System.Linq.Expressions.BinaryExpression MakeBinary (System.Linq.Expressions.ExpressionType binaryType, System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, bool liftToNull, System.Reflection.MethodInfo method, System.Linq.Expressions.LambdaExpression conversion);
public static System.Linq.Expressions.BinaryExpression MakeBinary (System.Linq.Expressions.ExpressionType binaryType, System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, bool liftToNull, System.Reflection.MethodInfo? method, System.Linq.Expressions.LambdaExpression? conversion);
static member MakeBinary : System.Linq.Expressions.ExpressionType * System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * bool * System.Reflection.MethodInfo * System.Linq.Expressions.LambdaExpression -> System.Linq.Expressions.BinaryExpression
Public Shared Function MakeBinary (binaryType As ExpressionType, left As Expression, right As Expression, liftToNull As Boolean, method As MethodInfo, conversion As LambdaExpression) As BinaryExpression
Parameters
- binaryType
- ExpressionType
The ExpressionType that specifies the type of binary operation.
- left
- Expression
An Expression that represents the left operand.
- right
- Expression
An Expression that represents the right operand.
- liftToNull
- Boolean
true
to set IsLiftedToNull to true
; false
to set IsLiftedToNull to false
.
- method
- MethodInfo
A MethodInfo that specifies the implementing method.
- conversion
- LambdaExpression
A LambdaExpression that represents a type conversion function. This parameter is used only if binaryType
is Coalesce or compound assignment.
Returns
The BinaryExpression that results from calling the appropriate factory method.
Exceptions
binaryType
does not correspond to a binary expression node.
left
or right
is null
.
Remarks
The binaryType
parameter determines which BinaryExpression factory method this method will call. For example, if binaryType
is Subtract, this method invokes Subtract. The liftToNull
, method
and conversion
parameters are ignored if the appropriate factory method does not have a corresponding parameter.