C# BitArray BitArray(Int32)

Description

BitArray BitArray(Int32) initializes a new instance of the BitArray class that can hold the specified number of bit values, which are initially set to false.

Syntax

BitArray.BitArray(Int32) has the following syntax.


public BitArray(
  int length
)

Parameters

BitArray.BitArray(Int32) has the following parameters.

  • length - The number of bit values in the new BitArray.

Example


//from ww w .  ja v a  2s .  c om
using System;
using System.Collections;
public class SamplesBitArray  {
   public static void Main()  {
      BitArray myBA = new BitArray( 5 );
      myBA[0] = myBA[1] = myBA[2] = myBA[3] = true;

      bool[] myBoolArray = new bool[8];
      myBoolArray[0] = false;
      myBoolArray[1] = false;

      myBA.CopyTo( myBoolArray, 3 );
   }

   public static void PrintValues( IEnumerable myArr )  {
      foreach ( Object obj in myArr ) {
         Console.WriteLine(obj );
      }
   }
}




















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack