BitArray : BitArray : Data Structure C# Examples


C# Examples » Data Structure » BitArray »

 

BitArray









    
using  System;  
using  System.Collections;  
  
class  MainClass  {  
    public  static  void  Main()  {  
        BitArray  ba  =  new  BitArray(8);  
        byte[]  b  =  {  67  };  
        BitArray  ba2  =  new  BitArray(b);  
          
        Console.WriteLine("Original  contents  of  ba:");  

        for(int  i=0;  i  <  ba.Count;  i++)  
            Console.Write("{0,  -6}  ",  ba[i]);  

        ba  =  ba.Not();  
  
        Console.WriteLine("Contents  of  ba  after  Not:");  
        for(int  i=0;  i  <  ba.Count;  i++)  
            Console.Write("{0,  -6}  ",  ba[i]);  

  
    }  
}
    
   
  
   



Output

Original contents of ba:
False  False  False  False  False  False  False  False  Contents of ba after Not:
True   True   True   True   True   True   True   True


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» BitArray