The StringDictionary Collection

The System.Collections.Specialized.StringDictionary collection works like the HashTable collection but differs in that it accepts only key/value pairs of type String, meaning that both keys and values must be String. The following is a small example:

Dim stringDemo As New StringDictionarystringDemo.Add("Key1", "Value1")stringDemo.Add("Alessandro", "Del Sole")'Simple iterationFor Each value As String In stringDemo.Values    Console.WriteLine(value)Next

You can recall the HashTable collection for a full member listing.

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.