What is the equivalent operator in VB.Net for ^ (this is for C#)
问题:
回答1:
The Xor operator is the equivalent.
Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions.
The C# ^
operator is:
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 ^
:
Raises a number to the power of another number.
It doesn't have a C# equivalent - you need to use Math.Pow
.
There are a few lists comparing syntax and features of both languages - I like this one and this one.
回答2:
Xor check VB.Net equivalent for C# operators here
回答3:
Xor Operator
Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions.
result = expression1 Xor expression2
回答4:
Math.Pow
should do the trick!
回答5:
public static double Math.Pow(double x, double y)
回答6:
Do you mean ^ as in bitwise XOR? In which case it would be Xor