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

And() public method

public And ( BitArray value ) : BitArray
value BitArray
return BitArray
        public BitArray And(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

            public static void BitArray_AndTest()
            {
                BitArray_Helper(Operator.And);

                // [] Test to make sure that 0 sized bit arrays can be And-ed

                BitArray b1 = new BitArray(0);
                BitArray b2 = new BitArray(0);

                b1.And(b2);
            }
All Usage Examples Of System.Collections.BitArray::And