Visual Basic の Dictionary は Hash のようなものです。Smalltalk に Dictionary というのがりますので Smalltalk 由来かも知れません。
XML ファイル
<configure> <item> <key>hoge</key> <value>http://www.example.com</value> </item> <item> <key>Googel</key> <value>http://www.google.com</value> </item> </configure>
Imports System Imports System.Collections.Generic Module Module1 Sub Main() Dim DirName As String Dim XMLName As String = "sample.xml" Dim dSet As New DataSet Dim dTbl As DataTable Dim sRead As IO.StreamReader Dim openWith As New Dictionary(Of String, String) DirName = System.IO.Directory.GetCurrentDirectory() Try dSet.ReadXmlSchema(DirName + "\" + XMLName) sRead = New IO.StreamReader(DirName + "\" + XMLName, System.Text.Encoding.Default) dSet.ReadXml(sRead) dTbl = dSet.Tables(0) For i = 0 To dTbl.Rows.Count() - 1 Try openWith.Add(dTbl.Rows(i)(0), dTbl.Rows(i)(1)) Catch Console.WriteLine("An element with Key = " & dTbl.Rows(i)(0) & " already exists.") End Try Next Catch E As Exception System.Console.WriteLine(E.Message) End Try System.Console.WriteLine(openWith("hoge")) ' hoge の値を表示 ' 全部表示 For Each kvp As KeyValuePair(Of String, String) In openWith System.Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value) Next kvp End Sub End Module
結果
http://www.example.com Key = hoge, Value = http://www.example.com Key = Googel, Value = http://www.google.com