最終更新:2008-07-16 (水) 23:02:42 (5734d)
Hashtable
Top / Hashtable
キーのハッシュ コードに基づいて編成された、キー/値ペアのコレクションを表します。
サンプル
Dim hash As New Hashtable() ' Add some elements to the hash table. There are no ' duplicate keys, but some of the values are duplicates. hash.Add("txt", "notepad.exe") hash.Add("bmp", "paint.exe") hash.Add("dib", "paint.exe") hash.Add("rtf", "wordpad.exe") ' The Add method throws an exception if the new key is ' already in the hash table. Try hash.Add("txt", "winword.exe") Catch Console.WriteLine("An element with Key = ""txt"" already exists.") End Try ' The Item property is the default property, so you ' can omit its name when accessing elements. Console.WriteLine("For key = ""rtf"", value = {0}.", hash("rtf")) For Each de As DictionaryEntry In hash Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value) Next de