BitArray.CopyTo copies the entire BitArray to a compatible one-dimensional Array
using System;
using System.Collections;
public class SamplesBitArray {
public static void Main() {
BitArray myBA = new BitArray( 4 );
myBA[0] = myBA[1] = myBA[2] = myBA[3] = true;
bool[] myBoolArray = new bool[8];
myBoolArray[0] = false;
myBoolArray[1] = false;
myBA.CopyTo( myBoolArray, 3 );
PrintValues( myBoolArray );
}
public static void PrintValues( IEnumerable myArr ) {
foreach ( Object obj in myArr ) {
Console.Write( "{0,8}", obj );
}
}
}
Related examples in the same category