Expression.MakeBinary 方法
定義
透過呼叫適當的 Factory 方法來建立 BinaryExpression。Creates a BinaryExpression by calling the appropriate factory method.
多載
MakeBinary(ExpressionType, Expression, Expression) |
透過呼叫適當的 Factory 方法來建立 BinaryExpression,指定左運算元和右運算元。Creates a BinaryExpression, given the left and right operands, by calling an appropriate factory method. |
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo) |
透過呼叫適當的 Factory 方法來建立 BinaryExpression,指定左運算元、右運算元和實作方法。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) |
透過呼叫適當的 Factory 方法來建立 BinaryExpression,指定左運算元、右運算元、實作方法和類型轉換函式。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)
透過呼叫適當的 Factory 方法來建立 BinaryExpression,指定左運算元和右運算元。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
參數
- binaryType
- ExpressionType
ExpressionType,指定二進位運算的類型。The ExpressionType that specifies the type of binary operation.
- left
- Expression
代表左運算元的 Expression。An Expression that represents the left operand.
- right
- Expression
代表右運算元的 Expression。An Expression that represents the right operand.
傳回
BinaryExpression,由呼叫適當的 Factory 方法所產生。The BinaryExpression that results from calling the appropriate factory method.
例外狀況
binaryType
未對應到二進位運算式節點。binaryType
does not correspond to a binary expression node.
left
或 right
為 null
。left
or right
is null
.
範例
下列範例示範如何使用 MakeBinary(ExpressionType, Expression, Expression) 方法來建立 BinaryExpression ,其代表一個數位與另一個數位的減法。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)
備註
binaryType
參數會決定 BinaryExpression 這個方法所呼叫的 factory 方法。The binaryType
parameter determines which BinaryExpression factory method this method calls. 例如,如果 binaryType
是 Subtract ,這個方法會叫用 Subtract 。For example, if binaryType
is Subtract, this method invokes Subtract.
適用於
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo)
透過呼叫適當的 Factory 方法來建立 BinaryExpression,指定左運算元、右運算元和實作方法。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
參數
- binaryType
- ExpressionType
ExpressionType,指定二進位運算的類型。The ExpressionType that specifies the type of binary operation.
- left
- Expression
代表左運算元的 Expression。An Expression that represents the left operand.
- right
- Expression
代表右運算元的 Expression。An Expression that represents the right operand.
- liftToNull
- Boolean
true
表示將 IsLiftedToNull 設定為 true
,false
則表示將 IsLiftedToNull 設定為 false
。true
to set IsLiftedToNull to true
; false
to set IsLiftedToNull to false
.
- method
- MethodInfo
MethodInfo,可指定實作的方法。A MethodInfo that specifies the implementing method.
傳回
BinaryExpression,由呼叫適當的 Factory 方法所產生。The BinaryExpression that results from calling the appropriate factory method.
例外狀況
binaryType
未對應到二進位運算式節點。binaryType
does not correspond to a binary expression node.
left
或 right
為 null
。left
or right
is null
.
備註
binaryType
參數 BinaryExpression 會決定此方法將呼叫的 factory 方法。The binaryType
parameter determines which BinaryExpression factory method this method will call. 例如,如果 binaryType
是 Subtract ,這個方法會叫用 Subtract 。For example, if binaryType
is Subtract, this method invokes Subtract. liftToNull
method
如果適當的 factory 方法沒有對應的參數,則會忽略和參數。The liftToNull
and method
parameters are ignored if the appropriate factory method does not have a corresponding parameter.
適用於
MakeBinary(ExpressionType, Expression, Expression, Boolean, MethodInfo, LambdaExpression)
透過呼叫適當的 Factory 方法來建立 BinaryExpression,指定左運算元、右運算元、實作方法和類型轉換函式。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
參數
- binaryType
- ExpressionType
ExpressionType,指定二進位運算的類型。The ExpressionType that specifies the type of binary operation.
- left
- Expression
代表左運算元的 Expression。An Expression that represents the left operand.
- right
- Expression
代表右運算元的 Expression。An Expression that represents the right operand.
- liftToNull
- Boolean
true
表示將 IsLiftedToNull 設定為 true
,false
則表示將 IsLiftedToNull 設定為 false
。true
to set IsLiftedToNull to true
; false
to set IsLiftedToNull to false
.
- method
- MethodInfo
MethodInfo,可指定實作的方法。A MethodInfo that specifies the implementing method.
- conversion
- LambdaExpression
代表類型轉換函式的 LambdaExpression。A LambdaExpression that represents a type conversion function. 只有當 binaryType
為 Coalesce 或複合指派時,才會使用此參數。This parameter is used only if binaryType
is Coalesce or compound assignment.
傳回
BinaryExpression,由呼叫適當的 Factory 方法所產生。The BinaryExpression that results from calling the appropriate factory method.
例外狀況
binaryType
未對應到二進位運算式節點。binaryType
does not correspond to a binary expression node.
left
或 right
為 null
。left
or right
is null
.
備註
binaryType
參數 BinaryExpression 會決定此方法將呼叫的 factory 方法。The binaryType
parameter determines which BinaryExpression factory method this method will call. 例如,如果 binaryType
是 Subtract ,這個方法會叫用 Subtract 。For example, if binaryType
is Subtract, this method invokes Subtract. liftToNull
method
conversion
如果適當的 factory 方法沒有對應的參數,則會忽略、和參數。The liftToNull
, method
and conversion
parameters are ignored if the appropriate factory method does not have a corresponding parameter.