BitArray.Xor Method (BitArray)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Performs the bitwise exclusive OR operation between the elements of the current BitArray object against the corresponding elements in the specified array. The current BitArray object will be modified to store the result of the bitwise exclusive OR operation.

Namespace:   System.Collections
Assembly:  mscorlib (in mscorlib.dll)

member Xor : 
        value:BitArray -> BitArray


Type: System.Collections.BitArray

The array with which to perform the bitwise exclusive OR operation.

Return Value

Type: System.Collections.BitArray

An array containing the result of the bitwise exclusive OR operation, which is a reference to the current BitArray object.

Exception Condition

value is null.


value and the current BitArray do not have the same number of elements.

The bitwise exclusive OR operation returns true if exactly one operand is true, and returns false if both operands have the same Boolean value.

This method is an O(n) operation, where n is Count.

The following code example shows how to perform the XOR operation between two BitArray objects.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top