The Bitwise Operators : Bitwise Operator « Operator « C# / CSharp Tutorial






  1. The bitwise operators act directly upon the bits of their operands.
  2. They are defined only for integer operands.
  3. They cannot be used on bool, float, or double.

The Bitwise Operators

OperatorResult
&Bitwise AND
|Bitwise OR
^Bitwise exclusive OR (XOR)
>Shift right
<Shift left
~One's complement (unary NOT)


pqp & qp | qp ^ q~p
000001
100110
010111
111100


3.9.Bitwise Operator
3.9.1.The Bitwise Operators
3.9.2.Bitwise Compound Assignments