Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Displays the keys and values of the Hashtable using foreach statement

Imports System Imports System.Collections Public Class HashtableExample     Public Shared Sub Main()         Dim clouds As New Hashtable()         clouds.Add("One", "1")         clouds.Add("Two", "2")         clouds.Add("Three", "3")         For Each de As DictionaryEntry in clouds             Console.WriteLine("    {0,-17}{1}", de.Key, de.Value)         Next de     End Sub End Class