illustrates the use of a BitArray : BitArray : Collections Data Structure C# Source Code


Custom Search

C# Source Code » Collections Data Structure » BitArray »

 

illustrates the use of a BitArray









    

/*
  illustrates the use of a BitArray
*/

using System;
using System.Collections;

public class Example11_4
{

  public static void Main()
  {

    // create a BitArray object
    BitArray myBitArray = new BitArray(4);

    // display the Length property
    Console.WriteLine("myBitArray.Length = " +
      myBitArray.Length);

    // set the four elements of the BitArray
    myBitArray[0] = false;
    myBitArray[1] = true;
    myBitArray[2] = true;
    myBitArray[3] = false;

    // display the elements of the BitArray
    for (int counter = 0; counter < myBitArray.Count; counter++)
    {
      Console.WriteLine("myBitArray[" + counter + "] = " +
        myBitArray[counter]);
    }

  }

}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Collections Data Structure
» BitArray