Get or set the value of the bit at a specific position in the BitArray in CSharp
Description
The following code shows how to get or set the value of the bit at a specific position in the BitArray.
Example
//from www . jav a2 s . c o m
using System;
using System.Collections;
public class SamplesBitArray {
public static void Main() {
BitArray myBA = new BitArray( new byte[]{0,0,0,1} );
myBA[0] = true;
Console.WriteLine(myBA[0]);
}
}
The code above generates the following result.