Dictionary<TKey, TValue>.GetEnumerator method is used to return an enumerator that iterates through the Dictionary<TKey, TValue>.
Syntax:
public System.Collections.Generic.Dictionary<TKey,TValue>.Enumerator GetEnumerator ();
Return Value: This method returns an Dictionary<TKey, TValue>.Enumerator structure for the Dictionary<TKey, TValue>.
Below programs illustrate the use of
Dictionary<TKey, TValue>.GetEnumerator Method:
Example 1:
Output:
Australia --> Canberra
Belgium --> Brussels
Netherlands --> Amsterdam
China --> Beijing
Russia --> Moscow
India --> New Delhi
Example 2: