C#入门与进阶|数组和集合(十一):BitArray类
发布时间
阅读量:
阅读量
BitArray类主要用于处理位值的压缩数组,其中位值以布尔形式进行表示,true对应数值1,false对应数值0。
BitArray类中常见的一些属性与方法包括:
| 属性 | 说明 |
|---|---|
| Count | 获取BitArray中包含的元素数。 |
| 方法 | 说明 |
| Get | 获取 BitArray 中特定位置处的位的值。 |
| Set | 将 BitArray 中特定位置处的位设置为指定值。 |
| SetAll | 将 BitArray 中的所有位设置为指定值。 |
BitArray实例说明:
public static void Main()
{
// Creates and initializes a BitArray.
BitArray myBA = new BitArray( 5 );
// Displays the properties and values of the BitArray.
Console.WriteLine( "myBA values:" );
PrintIndexAndValues( myBA );
// Sets all the elements to tru
全部评论 (0)
还没有任何评论哟~
