What is the BitArray class?
What is the BitArray class?
Rating:
The BitArray class manages a compact array of bit values. The values of the array are represented as booleans, where true indicates that the bit is on one (1), and false indicates that the bit is on zero (0).
The following code snippet displays the use of the BitArray class:
using System;
using System.Collections;
public class MyBitArrayClass
{
public static void Main()
{
BitArray mybitarr1 = new BitArray( 7 );
BitArray mybitarr2 = new BitArray( 9, false );
byte[] myBytes = new byte[5] { 1, 2, 3, 4, 5 };
BitArray mybiarr3 = new BitArray( myBytes );
Console.WriteLine( "mybitarr1" );
PrintTheValues( mybiarr1 );
Console.WriteLine( "mybitarr2" );
PrintTheValues( mybitarr2 );
Console.WriteLine( "mybitarr3" );
PrintTheValues( mybitarr3 );
}
public static void PrintTheValues( IEnumerable MyList)
{
foreach ( Object list in MyList )
Console.Write( list )
}
}
Rating:
Other articles
- What is an application domain?
- What are the types of marshalling supported by COM?
- What are the differences between the File and FileInfo classes?
- What is theIClassFactory interface?
- How to run the Console application?