Copy BitArray to Array, starting at the specified index of the target array in CSharp

Description

The following code shows how to copy BitArray to Array, starting at the specified index of the target array.

Example


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

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

      myBA.CopyTo( myBoolArray, 3 );

      foreach ( Object obj in myBoolArray ) {
         Console.WriteLine(obj );
      }
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary