Freigeben über


CodeBinaryOperatorExpression-Klasse

Stellt einen Ausdruck dar, der aus einer binären Operation zwischen zwei Ausdrücken besteht.

Namespace: System.CodeDom
Assembly: System (in system.dll)

Syntax

'Declaration
<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeBinaryOperatorExpression
    Inherits CodeExpression
'Usage
Dim instance As CodeBinaryOperatorExpression
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeBinaryOperatorExpression : CodeExpression
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeBinaryOperatorExpression : public CodeExpression
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeBinaryOperatorExpression extends CodeExpression
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeBinaryOperatorExpression extends CodeExpression

Hinweise

Mit CodeBinaryOperatorExpression können Codeausdrücke dargestellt werden, die einen binären Operator einschließen. Beispiele für binäre Operatoren sind der Gleichheitsoperator (==), der Additionsoperator (+) und bitweise Operatoren (|). Die CodeBinaryOperatorType-Enumeration stellt eine Gruppe grundlegender, häufig verwendeter binärer Operatoren dar, die in vielen Sprachen unterstützt werden.

Beispiel

In diesem Beispiel wird veranschaulicht, wie mit einer CodeBinaryOperatorExpression zwei Zahlen addiert werden.

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

// 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(System.Convert.ToString(1)),
    // CodeBinaryOperatorType enumeration value of Add.
    CodeBinaryOperatorType.Add,
    // Right operand.
    new CodePrimitiveExpression(System.Convert.ToString(2)));
// A VJ# code generator produces the following source code 
// for the preceeding example code:
// (1 + 2)        

Vererbungshierarchie

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

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CodeBinaryOperatorExpression-Member
System.CodeDom-Namespace
CodeExpression
CodeBinaryOperatorType