Wednesday, December 24, 2008

Use a Generic Dictionary

Declaring a generic dictionary; adding values:
Dim xGD As New Generic.Dictionary(Of String, String)
xGD.Add("key1", "value1")


Where the Key and Value (String, String) can be any object.

Getting access to a value:
Dim value as String = xGD("key1")


Looping:
For Each xKVP As Generic.KeyValuePair(Of String, String) In xGD
   Consoe.Writeline(xKVP.Key & ", " & xKVP.Value)
Next

No comments: