Expression.ExclusiveOr Méthode
Définition
Crée un BinaryExpression qui représente une opération XOR
au niveau du bit.Creates a BinaryExpression that represents a bitwise XOR
operation.
Surcharges
ExclusiveOr(Expression, Expression, MethodInfo) |
Crée un BinaryExpression qui représente une opération d’assignation |
ExclusiveOr(Expression, Expression) |
Crée un BinaryExpression qui représente une opération d’assignation |
ExclusiveOr(Expression, Expression, MethodInfo)
Crée un BinaryExpression qui représente une opération d’assignation XOR
au niveau du bit, en utilisant op_ExclusiveOr
pour les types définis par l’utilisateur.Creates a BinaryExpression that represents a bitwise XOR
operation, using op_ExclusiveOr
for user-defined types. La méthode d'implémentation peut être spécifiée.The implementing method can be specified.
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
Paramètres
- left
- Expression
Expression auquel la propriété Left doit être égale.An Expression to set the Left property equal to.
- right
- Expression
Expression auquel la propriété Right doit être égale.An Expression to set the Right property equal to.
- method
- MethodInfo
MethodInfo auquel la propriété Method doit être égale.A MethodInfo to set the Method property equal to.
Retours
BinaryExpression dont la propriété NodeType est égale à ExclusiveOr et dont les propriétés Left, Right et Method ont les valeurs spécifiées.A BinaryExpression that has the NodeType property equal to ExclusiveOr and the Left, Right, and Method properties set to the specified values.
Exceptions
left
ou right
est null
.left
or right
is null
.
method
n’est pas null
et la méthode représentée retourne void
, pas static
(Shared
dans Visual Basic) ou ne prend pas exactement deux arguments.method
is not null
and the method it represents returns void
, is not static
(Shared
in Visual Basic), or does not take exactly two arguments.
method
est null
et l’opérateur XOR
n’est pas défini pour les types left
.et right
.method
is null
and the XOR
operator is not defined for left
.Type and right
.Type.
Remarques
Le qui BinaryExpression en résulte a la Method propriété définie sur la méthode d’implémentation.The resulting BinaryExpression has the Method property set to the implementing method. La Type propriété est définie sur le type du nœud.The Type property is set to the type of the node. Si le nœud est levé, les IsLifted Propriétés et IsLiftedToNull sont toutes les deux true
.If the node is lifted, the IsLifted and IsLiftedToNull properties are both true
. Dans le cas contraire, il s’agit de false
.Otherwise, they are false
. La propriété Conversion a la valeur null
.The Conversion property is null
.
Les informations suivantes décrivent la méthode d’implémentation, le type de nœud et si un nœud est levé.The following information describes the implementing method, the node type, and whether a node is lifted.
Implémentation de la méthodeImplementing Method
Les règles suivantes déterminent la méthode d’implémentation choisie pour l’opération :The following rules determine the chosen implementing method for the operation:
Si
method
n’est pasnull
et qu’il représente une méthode non void,static
(Shared
en Visual Basic) qui prend deux arguments, il s’agit de la méthode d’implémentation.Ifmethod
is notnull
and it represents a non-void,static
(Shared
in Visual Basic) method that takes two arguments, it is the implementing method.Sinon, si la Type propriété de
left
ouright
représente un type défini par l’utilisateur qui surcharge l'XOR
opérateur, le MethodInfo qui représente cette méthode est la méthode d’implémentation.Otherwise, if the Type property of eitherleft
orright
represents a user-defined type that overloads theXOR
operator, the MethodInfo that represents that method is the implementing method.Sinon, si
left
. Tapez etright
. Le type sont des types intégraux ou booléens, la méthode d’implémentation estnull
.Otherwise, ifleft
.Type andright
.Type are integral or Boolean types, the implementing method isnull
.
Type de nœud, levé et non levéNode Type and Lifted versus Non-Lifted
Si la méthode d’implémentation n’est pas null
:If the implementing method is not null
:
Si
left
. Tapez etright
. Le type peuvent être assignés aux types d’arguments correspondants de la méthode d’implémentation, le nœud n’est pas levé.Ifleft
.Type andright
.Type are assignable to the corresponding argument types of the implementing method, the node is not lifted. Le type du nœud est le type de retour de la méthode d’implémentation.The type of the node is the return type of the implementing method.Si les deux conditions suivantes sont satisfaites, le nœud est levé et le type du nœud est le type Nullable qui correspond au type de retour de la méthode d’implémentation :If the following two conditions are satisfied, the node is lifted and the type of the node is the nullable type that corresponds to the return type of the implementing method:
left
. Tapez etright
. Le type sont à la fois des types valeur dont au moins un est Nullable et les types non Nullable correspondants sont égaux aux types d’arguments correspondants de la méthode d’implémentation.left
.Type andright
.Type are both value types of which at least one is nullable and the corresponding non-nullable types are equal to the corresponding argument types of the implementing method.Le type de retour de la méthode d’implémentation est un type valeur qui n’autorise pas les valeurs NULL.The return type of the implementing method is a non-nullable value type.
Si la méthode d’implémentation est null
:If the implementing method is null
:
Si
left
. Tapez etright
. Le type n’accepte pas les valeurs NULL, le nœud n’est pas levé.Ifleft
.Type andright
.Type are both non-nullable, the node is not lifted. Le type du nœud est le type de résultat de l'XOR
opérateur prédéfini.The type of the node is the result type of the predefinedXOR
operator.Si
left
. Tapez etright
. Le type acceptant les valeurs NULL, le nœud est levé.Ifleft
.Type andright
.Type are both nullable, the node is lifted. Le type du nœud est le type Nullable qui correspond au type de résultat de l'XOR
opérateur prédéfini.The type of the node is the nullable type that corresponds to the result type of the predefinedXOR
operator.
S’applique à
ExclusiveOr(Expression, Expression)
Crée un BinaryExpression qui représente une opération d’assignation XOR
au niveau du bit, en utilisant op_ExclusiveOr
pour les types définis par l’utilisateur.Creates a BinaryExpression that represents a bitwise XOR
operation, using op_ExclusiveOr
for user-defined types.
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
Paramètres
- left
- Expression
Expression auquel la propriété Left doit être égale.An Expression to set the Left property equal to.
- right
- Expression
Expression auquel la propriété Right doit être égale.An Expression to set the Right property equal to.
Retours
BinaryExpression dont la propriété NodeType est égale à ExclusiveOr et dont les propriétés Left et Right ont les valeurs spécifiées.A BinaryExpression that has the NodeType property equal to ExclusiveOr and the Left and Right properties set to the specified values.
Exceptions
left
ou right
est null
.left
or right
is null
.
L'opérateur XOR
n'est pas défini pour left
.Type et right
.Type.The XOR
operator is not defined for left
.Type and right
.Type.
Exemples
L’exemple de code suivant montre comment créer une expression qui représente l’opération XOR logique.The following code example shows how to create an expression that represents the logical XOR operation.
// 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
Remarques
Le qui BinaryExpression en résulte a la Method propriété définie sur la méthode d’implémentation.The resulting BinaryExpression has the Method property set to the implementing method. La Type propriété est définie sur le type du nœud.The Type property is set to the type of the node. Si le nœud est levé, les IsLifted Propriétés et IsLiftedToNull sont toutes les deux true
.If the node is lifted, the IsLifted and IsLiftedToNull properties are both true
. Dans le cas contraire, il s’agit de false
.Otherwise, they are false
. La propriété Conversion a la valeur null
.The Conversion property is null
.
Les informations suivantes décrivent la méthode d’implémentation, le type de nœud et si un nœud est levé.The following information describes the implementing method, the node type, and whether a node is lifted.
Implémentation de la méthodeImplementing Method
Les règles suivantes déterminent la méthode d’implémentation pour l’opération :The following rules determine the implementing method for the operation:
Si la Type propriété de
left
ouright
représente un type défini par l’utilisateur qui surcharge l'XOR
opérateur, le MethodInfo qui représente cette méthode est la méthode d’implémentation.If the Type property of eitherleft
orright
represents a user-defined type that overloads theXOR
operator, the MethodInfo that represents that method is the implementing method.Sinon, si
left
. Tapez etright
. Le type sont des types intégraux ou booléens, la méthode d’implémentation estnull
.Otherwise, ifleft
.Type andright
.Type are integral or Boolean types, the implementing method isnull
.
Type de nœud, levé et non levéNode Type and Lifted versus Non-Lifted
Si la méthode d’implémentation n’est pas null
:If the implementing method is not null
:
Si
left
. Tapez etright
. Le type peuvent être assignés aux types d’arguments correspondants de la méthode d’implémentation, le nœud n’est pas levé.Ifleft
.Type andright
.Type are assignable to the corresponding argument types of the implementing method, the node is not lifted. Le type du nœud est le type de retour de la méthode d’implémentation.The type of the node is the return type of the implementing method.Si les deux conditions suivantes sont satisfaites, le nœud est levé et le type du nœud est le type Nullable qui correspond au type de retour de la méthode d’implémentation :If the following two conditions are satisfied, the node is lifted and the type of the node is the nullable type that corresponds to the return type of the implementing method:
left
. Tapez etright
. Le type sont à la fois des types valeur dont au moins un est Nullable et les types non Nullable correspondants sont égaux aux types d’arguments correspondants de la méthode d’implémentation.left
.Type andright
.Type are both value types of which at least one is nullable and the corresponding non-nullable types are equal to the corresponding argument types of the implementing method.Le type de retour de la méthode d’implémentation est un type valeur qui n’autorise pas les valeurs NULL.The return type of the implementing method is a non-nullable value type.
Si la méthode d’implémentation est null
:If the implementing method is null
:
Si
left
. Tapez etright
. Le type n’accepte pas les valeurs NULL, le nœud n’est pas levé.Ifleft
.Type andright
.Type are both non-nullable, the node is not lifted. Le type du nœud est le type de résultat de l'XOR
opérateur prédéfini.The type of the node is the result type of the predefinedXOR
operator.Si
left
. Tapez etright
. Le type acceptant les valeurs NULL, le nœud est levé.Ifleft
.Type andright
.Type are both nullable, the node is lifted. Le type du nœud est le type Nullable qui correspond au type de résultat de l'XOR
opérateur prédéfini.The type of the node is the nullable type that corresponds to the result type of the predefinedXOR
operator.