Mono Class Library: System.Collections.BitArray Overview | Members

System.Collections.BitArray Constructor

Constructs and initializes a instance of the BitArray class from an array of ints. The first value in the int array sets the leaset significant bits of the bit array.

public BitArray (int[] values)

Parameters

values
Documentation for this section has not yet been entered.

Remarks

The int at index 0 of the int array sets the least significant bits of the BItArray. The bits of the BItArray are set using the two's complement value of the int integers.

C# Example

using System;
using System.Collections;

        public class BitArrayFromInt
        {
                public static void Main ()
                {
                        BitArray bitArray = new BitArray (new int [] {-1, 0});
                        Console.WriteLine ("bitArray.Count: {0}", bitArray.Count);
                        for (int i = 0; i < bitArray.Count; i += 8) {
                                Console.WriteLine ("bitArray [{0}]: {1}", i, bitArray [i]);
                                Console.WriteLine ("bitArray [{0}]: {1}", i + 7, bitArray [i + 7]);
                        }
                }
        }
  

Compiling and running the above example generates the following output:

bitArray.Count: 64

bitArray [0]: True

bitArray [7]: True

bitArray [8]: True

bitArray [15]: True

bitArray [16]: True

bitArray [23]: True

bitArray [24]: True

bitArray [31]: True

bitArray [32]: False

bitArray [39]: False

bitArray [40]: False

bitArray [47]: False

bitArray [48]: False

bitArray [55]: False

bitArray [56]: False

bitArray [63]: False

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0