new BitArray(byte[] b) : BitArray « System.Collections « C# / C Sharp by API






new BitArray(byte[] b)

  

using System; 
using System.Collections; 
 
public class BADemo { 
  public static void showbits(string rem, 
                         BitArray bits) { 
    Console.WriteLine(rem); 
    for(int i=0; i < bits.Count; i++) 
      Console.Write("{0, -6} ", bits[i]); 
    Console.WriteLine("\n"); 
  } 
 
  public static void Main() { 
    BitArray ba = new BitArray(8); 
    byte[] b = { 67 }; 
    BitArray ba2 = new BitArray(b); 
     
    showbits("Original contents of ba:", ba); 
       
    ba = ba.Not(); 
 
    showbits("Contents of ba after Not:", ba); 
 
    showbits("Contents of ba2:", ba2); 
 
    BitArray ba3 = ba.Xor(ba2); 
 
    showbits("Result of ba XOR ba2:", ba3); 
  } 
}

   
    
  








Related examples in the same category

1.new BitArray(int size)
2.BitArray.Length
3.BitArray.Not()
4.BitArray.Or
5.BitArray.Xor