NameValueCollection
Imports System.Collections.Specialized
public class Test
public Shared Sub Main
Dim nvc As New NameValueCollection
nvc.Add("Food", "Sandwich")
nvc.Add("Food", "Salad")
nvc.Add("Food", "Taco")
nvc.Add("Dessert", "Ice Cream")
nvc.Add("Dessert", "Pie")
nvc.Add("Dessert", "Cake")
nvc.Add("Dessert", "Cookie")
Dim values() As String
For Each key As String In nvc.Keys
Console.WriteLine(key & ":")
values = nvc.GetValues(key)
For Each value As String In values
Console.WriteLine(" " & value)
Next value
Next key
For Each key As String In nvc.Keys
Console.WriteLine(key & ": " & nvc.Item(key))
Next key
End Sub
End class
Food:
Sandwich
Salad
Taco
Dessert:
Ice Cream
Pie
Cake
Cookie
Food: Sandwich,Salad,Taco
Dessert: Ice Cream,Pie,Cake,Cookie