Set all bits in the BitArray to the specified value in CSharp
Description
The following code shows how to set all bits in the BitArray to the specified value.
Example
using System;/* ww w . ja va 2s.com*/
using System.Collections;
public class SamplesBitArray {
public static void Main() {
BitArray myBA = new BitArray( 5 );
PrintIndexAndValues( myBA );
myBA.SetAll( true );
PrintIndexAndValues( myBA );
}
public static void PrintIndexAndValues( IEnumerable myCol ) {
foreach ( Object obj in myCol ) {
Console.WriteLine(obj );
}
}
}
The code above generates the following result.