Create BitArray from the specified array of Booleans in CSharp
Description
The following code shows how to create BitArray from the specified array of Booleans.
Example
using System;// w ww . jav a 2s.co m
using System.Collections;
public class SamplesBitArray
{
public static void Main()
{
BitArray myBA = new BitArray(new Boolean[] { true, true, true, true });
myBA[0] = myBA[1] = myBA[2] = myBA[3] = true;
bool[] myBoolArray = new bool[8];
myBoolArray[0] = false;
myBoolArray[1] = false;
myBA.CopyTo(myBoolArray, 3);
foreach (Object obj in myBoolArray)
{
Console.WriteLine(obj);
}
}
}
The code above generates the following result.