Displays the contents of the OrderedDictionary using its enumerator
Imports System
Imports System.Collections
Imports System.Collections.Specialized
Public Class OrderedDictionarySample
Public Shared Sub Main()
Dim myOrderedDictionary As New OrderedDictionary()
myOrderedDictionary.Add("testKey1", "testValue1")
myOrderedDictionary.Add("testKey2", "testValue2")
Dim myEnumerator As IDictionaryEnumerator = myOrderedDictionary.GetEnumerator()
DisplayEnumerator(myEnumerator)
End Sub
Public Shared Sub DisplayEnumerator( _
ByVal myEnumerator As IDictionaryEnumerator)
While myEnumerator.MoveNext()
Console.WriteLine(" {0,-25} {1}", _
myEnumerator.Key, myEnumerator.Value)
End While
End Sub
End Class
Related examples in the same category