System.Collections.BitArray.Xor C# (CSharp) Method

Xor() public method

public Xor ( BitArray value ) : BitArray
value BitArray
return BitArray
        public BitArray Xor(BitArray value)
        {
            if (value == null)
                throw new ArgumentNullException(nameof(value));
            if (Length != value.Length)
                throw new ArgumentException(SR.Arg_ArrayLengthsDiffer);
            Contract.EndContractBlock();

            int ints = GetArrayLength(m_length, BitsPerInt32);
            for (int i = 0; i < ints; i++)
            {
                m_array[i] ^= value.m_array[i];
            }

            _version++;
            return this;
        }

Usage Example

示例#1
0
 static void Main(string[] args)
 {
     var bits = new BitArray(2);
     bits[1] = true;
     bits.Xor(bits); // Bitwise exclusive-OR bits with itself
     Console.WriteLine(bits[1]); // False
 }
All Usage Examples Of System.Collections.BitArray::Xor