Get the value of the bit at a specific position in the BitArray in CSharp
Description
The following code shows how to get the value of the bit at a specific position in the BitArray.
Example
using System;//from ww w .j a v a2 s.c om
using System.Collections;
public class SamplesBitArray {
public static void Main() {
BitArray myBA = new BitArray( 5 );
myBA.SetAll( true );
Console.WriteLine(myBA.Get( myBA.Count - 2 ) );
Console.WriteLine(myBA.Get( myBA.Count - 1 ) );
}
}
The code above generates the following result.