^运算符真的是C#中的XOR运算符吗?
收藏

I read that the ^ operator is the logical XOR operator in C#, but I also thought it was the "power of" operator. What is the explanation?

最佳答案

这不是C#运算符的能力,因为C#中没有这样的运算符。它只是XOR运算符。

对于“功效”,请使用Math.Pow。

As you can see from this page on the C# Operators, ^ is listed under the "Logical (boolean and bitwise)" category, which means it can both handle boolean values, and binary values (for bitwise XOR).

    公众号
    关注公众号订阅更多技术干货!