The Bitwise Operators : Bitwise Operator : Operator C# Examples


C# Examples » Operator » Bitwise Operator »

 

The Bitwise Operators






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

The Bitwise Operators



Operator
Result


&
Bitwise AND


|
Bitwise OR


^
Bitwise exclusive OR (XOR)


>
Shift right



Shift left


~
One's complement (unary NOT)






p
q
p & q
p | q
p ^ q
~p


0
0
0
0
0
1


1
0
0
1
1
0


0
1
0
1
1
1


1
1
1
1
0
0






HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Operator
» Bitwise Operator