Is the ^ operator really the XOR operator in C#?

偶尔善良 提交于 2019-12-09 14:00:32

问题


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?


回答1:


It is not the power of operator of C# since there is no such operator in C#. It is just the XOR operator.

For "power of", use 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).



来源:https://stackoverflow.com/questions/1508153/is-the-operator-really-the-xor-operator-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!