BitArray.Xor performs the bitwise exclusive OR operation
Imports System
Imports System.Collections
Imports Microsoft.VisualBasic
Public Class SamplesBitArray
Public Shared Sub Main()
Dim myBA1 As New BitArray(4)
Dim myBA2 As New BitArray(4)
myBA1(0) = False
myBA1(1) = False
myBA1(2) = True
myBA1(3) = True
myBA2(0) = False
myBA2(2) = False
myBA2(1) = True
myBA2(3) = True
PrintValues(myBA1)
PrintValues(myBA2)
PrintValues(myBA1.Xor(myBA2))
PrintValues(myBA1)
PrintValues(myBA2)
End Sub
Public Shared Sub PrintValues(myList As IEnumerable)
Dim obj As [Object]
For Each obj In myList
Console.WriteLine(obj)
Next obj
End Sub
End Class