Bitwise Operators : Bits : Data Type C# Examples


C# Examples » Data Type » Bits »

 

Bitwise Operators









    
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);
    }
}
    
   
  
   



Output

1
3
5


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Bits