C# BitArray GetEnumerator

Description

BitArray GetEnumerator returns an enumerator that iterates through the BitArray.

Syntax

BitArray.GetEnumerator has the following syntax.


public IEnumerator GetEnumerator()

Returns

BitArray.GetEnumerator method returns An IEnumerator for the entire BitArray.

Example


using System;/* w  w w . j  ava2  s.c o m*/
using System.Collections;
public class SamplesBitArray  {

   public static void Main()  {
      BitArray myBA = new BitArray( 5 );
      myBA.Set( myBA.Count - 1, false );

      PrintIndexAndValues( myBA );
   }


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

}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack