Here we create a List that stores KeyValuePairs. The (Of String, Integer) syntax is used to specify that the key is a String, and the value is an Integer.
Module Module1
Sub Main()
' Create List of key-value pairs.
Dim list As List(Of KeyValuePair(Of String, Integer)) =
New List(Of KeyValuePair(Of String, Integer))
list.Add(New KeyValuePair(Of String, Integer)(
"Cat", 1))
list.Add(New KeyValuePair(Of String, Integer)(
"Dog", 2))
list.Add(New KeyValuePair(Of String, Integer)(
"Rabbit", 4))
' Loop over pairs.
For Each pair As KeyValuePair(Of String, Integer) In list
' Display key and value.
Console.WriteLine(pair)
Next
End Sub
End Module
[Cat, 1]
[Dog, 2]
[Rabbit, 4]