BitArray.CopyTo copies the entire BitArray to a compatible one-dimensional Array : BitArray « Collections Data Structure « C# / C Sharp






BitArray.CopyTo copies the entire BitArray to a compatible one-dimensional Array

 

using System;
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 );

      PrintValues( myBoolArray );
   }

   public static void PrintValues( IEnumerable myArr )  {
      foreach ( Object obj in myArr ) {
         Console.Write( "{0,8}", obj );
      }
   }
}

   
  








Related examples in the same category

1.Demonstrate BitArrayDemonstrate BitArray
2.Use BitArray collection as Flag
3.illustrates the use of a BitArrayillustrates the use of a BitArray
4.illustrates the use of BitArray methodsillustrates the use of BitArray methods
5.BitArray Class manages a compact array of bit values
6.Displays the properties and values of the BitArrays
7.Gets the value of the bit at a specific position in the BitArray.
8.Inverts all the bit values in the current BitArray
9.Performs the bitwise OR operation
10.Performing OR between BitArray instances of different sizes returns an exception
11.Performs bitwise exclusive OR operation