Bitwise Operators
Bitwise operators: & (AND), | (OR), ^ (XOR), ~ (NOT), << (left shift), >> (right shift).
int a = 6; // 0110int b = 3; // 0011Console.WriteLine($"a & b = {a & b}"); // 0010 = 2Console.WriteLine($"a | b = {a | b}"); // 0111 = 7Console.WriteLine($"a ^ b = {a ^ b}"); // 0101 = 5Run the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”a & b = 2a | b = 7a ^ b = 5