CodeBinaryOperatorExpression 类

定义

表示一个表达式,该表达式包含在两个表达式间进行的二进制运算。

public ref class CodeBinaryOperatorExpression : System::CodeDom::CodeExpression
public class CodeBinaryOperatorExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeBinaryOperatorExpression : System.CodeDom.CodeExpression
type CodeBinaryOperatorExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeBinaryOperatorExpression = class
    inherit CodeExpression
Public Class CodeBinaryOperatorExpression
Inherits CodeExpression
继承
CodeBinaryOperatorExpression
属性

示例

此示例演示如何使用 将两个 CodeBinaryOperatorExpression 数字相加。

// This CodeBinaryOperatorExpression represents the addition of 1 and 2.

// Right operand.
CodeBinaryOperatorExpression^ addMethod = gcnew CodeBinaryOperatorExpression( gcnew CodePrimitiveExpression( 1 ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 2 ) );

// A C# code generator produces the following source code for the preceeding example code:
// (1 + 2)
// This CodeBinaryOperatorExpression represents the addition of 1 and 2.
CodeBinaryOperatorExpression addMethod = new CodeBinaryOperatorExpression(

    // Left operand.
    new CodePrimitiveExpression(1),

    // CodeBinaryOperatorType enumeration value of Add.
    CodeBinaryOperatorType.Add,

    // Right operand.
    new CodePrimitiveExpression(2) );

// A C# code generator produces the following source code for the preceeding example code:

// (1 + 2)
' This CodeBinaryOperatorExpression represents the addition of 1 and 2.
Dim addMethod As New CodeBinaryOperatorExpression( _
   New CodePrimitiveExpression(1), _         
   CodeBinaryOperatorType.Add, _            
   New CodePrimitiveExpression(2) )        

' A Visual Basic code generator produces the following source code for the preceeding example code:	

' (1 + 2)

注解

CodeBinaryOperatorExpression 可用于表示包含二进制运算符的代码表达式。 二元运算符的一些示例包括相等 (==) 、加法 (+) 和按位 (|) 运算符。 CodeBinaryOperatorType枚举表示一组在多种语言中支持的常用基本二元运算符。

构造函数

CodeBinaryOperatorExpression()

初始化 CodeBinaryOperatorExpression 类的新实例。

CodeBinaryOperatorExpression(CodeExpression, CodeBinaryOperatorType, CodeExpression)

使用指定参数初始化 CodeBinaryOperatorExpression 类的新实例。

属性

Left

获取或设置运算符左边的代码表达式。

Operator

获取或设置二进制运算符表达式中的运算符。

Right

获取或设置运算符右边的代码表达式。

UserData

获取当前对象的用户可定义数据。

(继承自 CodeObject)

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅