Return an enumerator that iterates through the BitArray in CSharp
Description
The following code shows how to return an enumerator that iterates through the BitArray.
Example
using System;//from w w w . j a va 2 s .c o m
using System.Collections;
public class SamplesBitArray {
public static void Main() {
BitArray myBA = new BitArray( 5 );
myBA.Set( myBA.Count - 1, false );
PrintIndexAndValues( myBA );
}
public static void PrintIndexAndValues( IEnumerable myCol ) {
foreach ( Object obj in myCol ) {
Console.WriteLine(obj );
}
}
}
The code above generates the following result.