Search code examples
c#.netoperators

What are the | and ^ operators used for?


Possible Duplicate:
What are bitwise operators?

Recently I came across a few samples that used the | and ^ operators. I am guessing these are or and negation operators.

So what actually do these operators stands for?


Solution

  • If you apply it to integral types, they are bitwise or and xor operator. However if you apply them to boolean types, they are logical or and xor. Look at an explanation of or operator and xor operator

    You can get more details on boolean operations from the wikipedia truth table