BinaryExpression Class
Represents an expression that has a binary operator.
Assembly: System.Core (in System.Core.dll)
The following tables summarize the factory methods that can be used to create a BinaryExpression that has a specific node type, represented by the NodeType property. Each table contains information for a specific class of operations such as arithmetic or bitwise.
Binary Arithmetic Operations
Bitwise Operations
Node Type | Factory Method |
|---|---|
Shift Operations
Node Type | Factory Method |
|---|---|
Conditional Boolean Operations
Comparison Operations
Coalescing Operations
Array Indexing Operations
Node Type | Factory Method |
|---|---|
In addition, the MakeBinary methods can also be used to create a BinaryExpression. These factory methods can be used to create a BinaryExpression of any node type that represents a binary operation. The parameter of these methods that is of type NodeType specifies the desired node type.
The following example creates a BinaryExpression object 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)) Console.WriteLine(binaryExpression.ToString()) ' This code produces the following output: ' ' (53 - 14)
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.