C# HybridDictionary GetEnumerator

Description

HybridDictionary GetEnumerator returns an IDictionaryEnumerator that iterates through the HybridDictionary.

Syntax

HybridDictionary.GetEnumerator has the following syntax.


public IDictionaryEnumerator GetEnumerator()

Returns

HybridDictionary.GetEnumerator method returns An IDictionaryEnumerator for the HybridDictionary.

Example

The following code example enumerates the elements of a HybridDictionary.


/* w  w w .  j  a v a2  s.c  o  m*/
using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesHybridDictionary  {

   public static void Main()  {
      HybridDictionary myCol = new HybridDictionary();
      myCol.Add( "F", "1.49" );
      myCol.Add( "A", "1.29" );
      myCol.Add( "B", "1.49" );
      myCol.Add( "C", "1.29" );

      IDictionaryEnumerator myEnumerator = myCol.GetEnumerator();
      while ( myEnumerator.MoveNext() )
         Console.WriteLine( "   {0,-25} {1}", myEnumerator.Key, myEnumerator.Value );
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections.Specialized »




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator