C# BitArray BitArray(Int32[]) Array

Description

BitArray BitArray(Int32[]) initializes a new instance of the BitArray class that contains bit values copied from the specified array of 32-bit integers.

Syntax

BitArray.BitArray(Int32[]) has the following syntax.


public BitArray(
  int[] values
)

Parameters

BitArray.BitArray(Int32[]) has the following parameters.

  • values - An array of integers containing the values to copy, where each integer represents 32 consecutive bits.

Example


/*  ww w  .j av  a  2  s .com*/
using System;
using System.Collections;
public class SamplesBitArray  {
   public static void Main()  {
      BitArray myBA = new BitArray( new int[]{0,0,0,1} );
      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