简体   繁体   English

VB.Net相当于C#中的^运算符

[英]VB.Net equivalent of ^ operator in C#

在VB.Net中, ^的等效运算符是什么(这对于C#)

The Xor operator is the equivalent. Xor运算符是等效的。

Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions. 对两个布尔表达式执行逻辑排除,或对两个数值表达式执行按位排除。

The C# ^ operator is: C# ^运算符为:

Binary ^ operators are predefined for the integral types and bool. 预定义了整数类型和布尔值的二进制^运算符。 For integral types, ^ computes the bitwise exclusive-OR of its operands. 对于整数类型,^计算其操作数的按位异或。 For bool operands, ^ computes the logical exclusive-or of its operands; 对于布尔操作数,^计算其操作数的逻辑异或; that is, the result is true if and only if exactly one of its operands is true. 也就是说,当且仅当其操作数之一恰好为真时,结果才为真。


If you mean the VB.NET power operator ^ : 如果您的意思是VB.NET 电源运算符^

Raises a number to the power of another number. 将一个数字提高到另一个数字的幂。

It doesn't have a C# equivalent - you need to use Math.Pow . 它没有C#等效项-您需要使用Math.Pow


There are a few lists comparing syntax and features of both languages - I like this one and this one . 有比较两种语言的语法和特性的一些名单-我喜欢这一个这一个

Xor 在这里检查C#运算符的VB.Net等效项

Xor Operator 异或运算符

Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions. 对两个布尔表达式执行逻辑排除,或对两个数值表达式执行按位排除。

result = expression1 Xor expression2

Math.Pow应该可以解决问题!

public static double Math.Pow(double x, double y)

Do you mean ^ as in bitwise XOR ? 您是按位XOR表示^吗? In which case it would be Xor 在这种情况下将是Xor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM