Constructs and initializes a new instance of the BitArray class from an existing BitArray.
- bits
- The BItArray to copy.
C# Example
using System; using System.Collections; public class BitArrayFromBitArray { public static void Main () { BitArray bitArray = new BitArray (new bool [] {true, true, false, false, true}); BitArray newBitArray = new BitArray (bitArray); Console.WriteLine ("bitArray.Count: {0}", bitArray.Count); for (int i = 0; i < bitArray.Count; i++) { Console.Write ("bitArray [{0}]: {1}", i, bitArray [i]); Console.WriteLine ("\tnewBitArray [{0}]: {1}", i, newBitArray [i]); } } }Compiling and running the above example generates the following output:
bitArray.Count: 5
bitArray [0]: True newBitArray [0]: True
bitArray [1]: True newBitArray [1]: True
bitArray [2]: False newBitArray [2]: False
bitArray [3]: False newBitArray [3]: False
bitArray [4]: True newBitArray [4]: True
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0