Bitwise Operators : Bits « Data Type « C# / CSharp Tutorial






using System;

class MainClass 
{
  static void Main(string[] args)
  {
    long MyBit = 0x1;
    long MyBitResult = 0;

    MyBitResult = MyBit & 0x1;
    Console.WriteLine(MyBitResult);
    
    MyBitResult = MyBit | 0x2;
    Console.WriteLine(MyBitResult);
    
    MyBitResult = MyBit ^ 0x4;
    Console.WriteLine(MyBitResult);
  }
}
1
3
5








2.42.Bits
2.42.1.Bitwise Operators
2.42.2.Display the bits within a byte.
2.42.3.Use enum value to mark BitArrays
2.42.4.Converts the bit patterns of UInt32 values to Byte arrays with the GetBytes method.