.NET Framework Class Library  

CodeBinaryOperatorExpression Class

Represents an expression that consists of a binary operation between two expressions.

For a list of all members of this type, see CodeBinaryOperatorExpression Members.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeExpression
         System.CodeDom.CodeBinaryOperatorExpression

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeBinaryOperatorExpression
   Inherits CodeExpression
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeBinaryOperatorExpression : CodeExpression
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeBinaryOperatorExpression : public
   CodeExpression
[JScript]
public
   Serializable
   ClassInterface(ClassInterfaceType.AutoDispatch)
   ComVisible(true)
class CodeBinaryOperatorExpression extends CodeExpression

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

CodeBinaryOperatorExpression can be used to represent code expressions that include a binary operator. Some examples of binary operators are equality (==), addition (+), and bitwise (|) operators. The CodeBinaryOperatorType enumeration represents a set of basic, commonly used binary operators that are supported in many languages.

Example

[Visual Basic, C#] This example demonstrates use of a CodeBinaryOperatorExpression to add two numbers together.

[Visual Basic] 
' 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)


[C#] 
// 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)        

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodeBinaryOperatorExpression Members | System.CodeDom Namespace | CodeExpression | CodeBinaryOperatorType