Constructs and initializes a new instance of the BitArray class with the specified Count and all values initialized to either true or false.
- length
- The Length (Count) of the new BItArray.
- defaultValue
- The initial value of all Bits.
C# Example
using System; using System.Collections; public class BitArrayFromIntWithDefault { public static void Main () { BitArray bitArray = new BitArray (7, true); Console.WriteLine ("bitArray.Count: {0}", bitArray.Count); for (int i = 0; i < bitArray.Count; i++) Console.WriteLine ("bitArray [{0}]: {1}", i, bitArray [i]); } }Compiling and running the above example generates the following output:
bitArray.Count: 7
bitArray [0]: True
bitArray [1]: True
bitArray [2]: True
bitArray [3]: True
bitArray [4]: True
bitArray [5]: True
bitArray [6]: True
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0