BitArray.Xor : BitArray « System.Collections « C# / C Sharp by API






BitArray.Xor

 

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(byte[] b)
2.new BitArray(int size)
3.BitArray.Length
4.BitArray.Not()
5.BitArray.Or