Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Expression.MakeBinary Method (ExpressionType, Expression, Expression)

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

Namespace:  System.Linq.Expressions
Assembly:  System.Core (in System.Core.dll)
'Declaration
Public Shared Function MakeBinary ( _
	binaryType As ExpressionType, _
	left As Expression, _
	right As Expression _
) As BinaryExpression

Parameters

binaryType
Type: System.Linq.Expressions.ExpressionType
The ExpressionType that specifies the type of binary operation.
left
Type: System.Linq.Expressions.Expression
An Expression that represents the left operand.
right
Type: System.Linq.Expressions.Expression
An Expression that represents the right operand.

Return Value

Type: System.Linq.Expressions.BinaryExpression
The BinaryExpression that results from calling the appropriate factory method.
ExceptionCondition
ArgumentException

binaryType does not correspond to a binary expression node.

ArgumentNullException

left or right is Nothing.

The binaryType parameter determines which BinaryExpression factory method this method calls. For example, if binaryType is Subtract, this method invokes Subtract.

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.
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))

outputBlock.Text &= binaryExpression.ToString() & vbCrLf

' This code produces the following output:
'
' (53 - 14)


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.