CodeBinaryOperatorExpression 类

定义

表示由两个表达式之间的二进制操作组成的表达式。

public ref 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
[<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
属性

示例

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

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

适用于

另请参阅