Imports System
Imports System.Collections
Public Class SamplesHashtable
Public Shared Sub Main()
Dim myHT As New Hashtable()
myHT.Add("one", "The")
myHT.Add("two", "quick")
myHT.Add("three", "brown")
Console.WriteLine(" Count : {0}", myHT.Count)
PrintKeysAndValues(myHT)
myHT.Clear()
Console.WriteLine(" Count : {0}", myHT.Count)
PrintKeysAndValues(myHT)
End Sub 'Main
Public Shared Sub PrintKeysAndValues(myHT As Hashtable)
Console.WriteLine(vbTab + "-KEY-" + vbTab + "-VALUE-")
Dim de As DictionaryEntry
For Each de In myHT
Console.WriteLine(vbTab + "{0}:" + vbTab + "{1}", de.Key, de.Value)
Next de
Console.WriteLine()
End Sub
End Class