Expression.ExclusiveOr 메서드

정의

비트 BinaryExpression 연산을 나타내는 XOR을 만듭니다.

오버로드

ExclusiveOr(Expression, Expression, MethodInfo)

사용자 정의 형식에 대해 op_ExclusiveOr을 사용하여 비트 XOR 연산을 나타내는 BinaryExpression을 만듭니다. 구현 메서드를 지정할 수 있습니다.

ExclusiveOr(Expression, Expression)

사용자 정의 형식에 대해 op_ExclusiveOr을 사용하여 비트 XOR 연산을 나타내는 BinaryExpression을 만듭니다.

ExclusiveOr(Expression, Expression, MethodInfo)

사용자 정의 형식에 대해 op_ExclusiveOr을 사용하여 비트 XOR 연산을 나타내는 BinaryExpression을 만듭니다. 구현 메서드를 지정할 수 있습니다.

public:
 static System::Linq::Expressions::BinaryExpression ^ ExclusiveOr(System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right, System::Reflection::MethodInfo ^ method);
public static System.Linq.Expressions.BinaryExpression ExclusiveOr (System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, System.Reflection.MethodInfo method);
public static System.Linq.Expressions.BinaryExpression ExclusiveOr (System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, System.Reflection.MethodInfo? method);
static member ExclusiveOr : System.Linq.Expressions.Expression * System.Linq.Expressions.Expression * System.Reflection.MethodInfo -> System.Linq.Expressions.BinaryExpression
Public Shared Function ExclusiveOr (left As Expression, right As Expression, method As MethodInfo) As BinaryExpression

매개 변수

left
Expression

Expression 속성에 설정할 Left입니다.

right
Expression

Expression 속성에 설정할 Right입니다.

method
MethodInfo

MethodInfo 속성에 설정할 Method입니다.

반환

BinaryExpression

BinaryExpression 속성이 NodeType이고 ExclusiveOr, LeftRight 속성이 지정된 값으로 설정된 Method입니다.

예외

left 또는 rightnull인 경우

methodnull이 아니고 이것이 나타내는 메서드가 void를 반환하거나, static(Visual Basic의 Shared)이 아니거나, 정확히 두 개의 인수를 사용하지 않는 경우

methodnull이고 XOR 연산자가 left.Type 및 right.Type에 대해 정의되지 않은 경우

설명

결과 BinaryExpression Method 에서 구현 메서드로 설정된 속성이 있습니다. 속성 Type 은 노드의 형식으로 설정됩니다. 노드가 해제되면 IsLifted 속성과 IsLiftedToNull 속성이 둘 다 true있습니다. 그렇지 않으면 다음과 같습니다 false. Conversion 속성은 null입니다.

다음 정보는 구현 방법, 노드 유형 및 노드 해제 여부를 설명합니다.

구현 방법

다음 규칙은 작업에 대해 선택한 구현 방법을 결정합니다.

  • 그렇지 않고 null 두 개의 인수를 사용하는 비 void, static (SharedVisual Basic) 메서드를 나타내는 경우 method 구현 메서드입니다.

  • 그렇지 않으면 Type 연산 MethodInfo 자를 오버로드 XOR 하는 사용자 정의 형식 중 하나 left 또는 right 해당 메서드를 나타내는 사용자 정의 형식의 속성이 구현 메서드입니다.

  • 그렇지 않으면 .이고, 그렇지 않으면 left 형식 및 right. 형식은 정수 또는 부울 형식이며 구현 메서드는 다음과 같습니다 null.

노드 유형 및 해제됨 및 해제되지 않은 노드

구현 메서드가 아닌 null경우:

  • If left. 형식 및 right. 형식은 구현 메서드의 해당 인수 형식에 할당할 수 있으며 노드는 해제되지 않습니다. 노드의 형식은 구현 메서드의 반환 형식입니다.

  • 다음 두 조건이 충족되면 노드가 해제되고 노드의 형식은 구현 메서드의 반환 형식에 해당하는 nullable 형식입니다.

    • left. 형식 및 right. 형식은 둘 다 하나 이상의 null 허용 값 형식이며 해당 nullable이 아닌 형식은 구현 메서드의 해당 인수 형식과 같습니다.

    • 구현 메서드의 반환 형식은 nullable이 아닌 값 형식입니다.

구현 방법이 다음과 같은 경우:null

  • If left. 형식 및 right. 형식은 모두 nullable이 아니고 노드가 해제되지 않습니다. 노드의 형식은 미리 정의된 XOR 연산자의 결과 형식입니다.

  • If left. 형식 및 right. 형식은 모두 nullable이고 노드는 해제됩니다. 노드의 형식은 미리 정의된 XOR 연산자의 결과 형식에 해당하는 nullable 형식입니다.

적용 대상

ExclusiveOr(Expression, Expression)

사용자 정의 형식에 대해 op_ExclusiveOr을 사용하여 비트 XOR 연산을 나타내는 BinaryExpression을 만듭니다.

public:
 static System::Linq::Expressions::BinaryExpression ^ ExclusiveOr(System::Linq::Expressions::Expression ^ left, System::Linq::Expressions::Expression ^ right);
public static System.Linq.Expressions.BinaryExpression ExclusiveOr (System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right);
static member ExclusiveOr : System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.BinaryExpression
Public Shared Function ExclusiveOr (left As Expression, right As Expression) As BinaryExpression

매개 변수

left
Expression

Expression 속성에 설정할 Left입니다.

right
Expression

Expression 속성에 설정할 Right입니다.

반환

BinaryExpression

BinaryExpression 속성이 NodeType이고 ExclusiveOrLeft 속성이 지정된 값으로 설정된 Right입니다.

예외

left 또는 rightnull인 경우

left.Type 및 right.Type에 XOR 연산자가 정의되지 않은 경우

예제

다음 코드 예제에서는 논리 XOR 작업을 나타내는 식을 만드는 방법을 보여 줍니다.

// Add the following directive to your file:
// using System.Linq.Expressions;

// This expression represents an exclusive OR operation for its two arguments.
// Both arguments must be of the same type,
// which can be either integer or boolean.

Expression exclusiveOrExpr = Expression.ExclusiveOr(
    Expression.Constant(5),
    Expression.Constant(3)
);

// Print out the expression.
Console.WriteLine(exclusiveOrExpr.ToString());

// The following statement first creates an expression tree,
// then compiles it, and then executes it.
Console.WriteLine(
    Expression.Lambda<Func<int>>(exclusiveOrExpr).Compile()());

// The XOR operation is performed as follows:
// 101 xor 011 = 110

// This code example produces the following output:
//
// (5 ^ 3)
// 6
' Add the following directive to your file:
' Imports System.Linq.Expressions   

' This expression represents an exclusive OR operation for its two arguments.
' Both arguments must be of the same type, 
' which can be either integer or Boolean.

Dim exclusiveOrExpr As Expression = Expression.ExclusiveOr(
     Expression.Constant(5),
     Expression.Constant(3)
 )

' Print the expression.
Console.WriteLine(exclusiveOrExpr.ToString())

' The following statement first creates an expression tree,
' then compiles it, and then executes it.           
Console.WriteLine(
    Expression.Lambda(Of Func(Of Integer))(exclusiveOrExpr).Compile()())

' The XOR operation is performed as follows:
' 101 xor 011 = 110

' This code example produces the following output:
'
' (5 ^ 3)
' 6

설명

결과 BinaryExpression Method 에서 구현 메서드로 설정된 속성이 있습니다. 속성 Type 은 노드의 형식으로 설정됩니다. 노드가 해제되면 IsLifted 속성과 IsLiftedToNull 속성이 둘 다 true있습니다. 그렇지 않으면 다음과 같습니다 false. Conversion 속성은 null입니다.

다음 정보는 구현 방법, 노드 유형 및 노드 해제 여부를 설명합니다.

구현 방법

다음 규칙은 작업에 대한 구현 방법을 결정합니다.

  • Type 연산 MethodInfo 자를 오버로드 XOR 하는 사용자 정의 형식 중 하나 left 또는 right 해당 메서드의 속성을 나타내는 경우 해당 메서드를 나타내는 형식은 구현 메서드입니다.

  • 그렇지 않으면 .이고, 그렇지 않으면 left 형식 및 right. 형식은 정수 또는 부울 형식이며 구현 메서드는 다음과 같습니다 null.

노드 유형 및 해제됨 및 해제되지 않은 노드

구현 메서드가 아닌 null경우:

  • If left. 형식 및 right. 형식은 구현 메서드의 해당 인수 형식에 할당할 수 있으며 노드는 해제되지 않습니다. 노드의 형식은 구현 메서드의 반환 형식입니다.

  • 다음 두 조건이 충족되면 노드가 해제되고 노드의 형식은 구현 메서드의 반환 형식에 해당하는 nullable 형식입니다.

    • left. 형식 및 right. 형식은 둘 다 하나 이상의 null 허용 값 형식이며 해당 nullable이 아닌 형식은 구현 메서드의 해당 인수 형식과 같습니다.

    • 구현 메서드의 반환 형식은 nullable이 아닌 값 형식입니다.

구현 방법이 다음과 같은 경우:null

  • If left. 형식 및 right. 형식은 모두 nullable이 아니고 노드가 해제되지 않습니다. 노드의 형식은 미리 정의된 XOR 연산자의 결과 형식입니다.

  • If left. 형식 및 right. 형식은 모두 nullable이고 노드는 해제됩니다. 노드의 형식은 미리 정의된 XOR 연산자의 결과 형식에 해당하는 nullable 형식입니다.

적용 대상