dictionary
「dictionary」とは、辞書・辞典のことを意味する英語表現である。
「dictionary」とは・「dictionary」の意味
「dictionary」は、名詞として用いられ、「辞書」「辞典」といった意味をもつ。可算名詞である。「dictionary」の複数形
「dictionary」の複数形は「dictionaries」である。「dictionary」の発音・読み方
「dictionary」の発音記号は、「díkʃənèri」である。カタカナで表記すると、「ディクショナリー」となる。実際に発音する際は、「ディィクシャネェリィ」のようになる。「d」は、舌先を前歯の裏の歯茎につけて息を止めた状態から、勢いよく息を破裂させるようにして「ドゥ」という音を出す。「i」は、日本語の「エ」と「イ」を同時に言うイメージで「イ」と発音する。「k」は、舌の後部を上げて上あごの奥につけ、息を止めた状態を作った後、急に舌を離して息を破裂させながら「クッ」という音を出す。「ʃ」は、唇を丸く突き出し、舌先を上の歯茎に近づけて息だけで「シュ」と音を出す。「ə」は、口を少し開け、弱くあいまいに「ア」と言う。「n」は、舌先を前歯の裏の歯茎につけて息が口から出るのを止め、鼻に抜けるように「ヌ」という音を出す。「e」は、口を左右に少し大きめに開け、日本語の「エ」とほぼ同じ発音をする。「r」は、舌先を内側に巻き上げて口内に触れないようにして、「ル」に近いラ行の音を出し、すぐに「i」の発音を行う。
「dictionary」の語源・由来
「dictionary」の原義は、「言うこと」「言う言葉が保管されている場所」である。印欧語系で「示す」という意味をもつ「deyk-」がラテン語で「言う」という意味をもつ「dico」となり、「こと」という意味をもつ「-tio」が付属したことで、ラテン語で「言うこと」という意味をもつ「dictio」となった。これに「物が保管されている場所」という意味をもつ「-arium」が付属して、ラテン語で「辞書」という意味をもつ「dictionarium」へと変化した。これが転じて最終的に英語でも「dictionary」という表現が用いられるようになった。
「dictionary」を含む英熟語・英語表現
「my dictionary」とは
「my dictionary」は、「私が持っている辞書」という意味をもつ。
「english dictionary」とは
「english dictionary」は、「英語辞書」「英語辞典」といった意味をもつ。
「a Japanese-English dictionary」とは
「a Japanese-English dictionary」は、「和英辞典」という意味をもつ。
「consult a dictionary」とは
「consult a dictionary」は、「辞書を引く」という意味をもつ。
「look up a word in a dictionary」とは
「look up a word in a dictionary」は、「辞書で単語を調べる」という意味をもつ。
「a biographical dictionary」とは
「a biographical dictionary」は、「人名辞典」という意味をもつ。
「a multilingual dictionary」とは
「a multilingual dictionary」は、「多国語辞典」という意味をもつ。
「a beginner's dictionary」とは
「a beginner's dictionary」は、「初学者向きの辞書」という意味をもつ。
「a walking dictionary」とは
「a walking dictionary」は、「生き字引」「物知り」といった意味をもつ。
「a rhyming dictionary」とは
「a rhyming dictionary」は、「押韻語辞典」という意味をもつ。
「a medical dictionary」とは
「a medical dictionary」は、「医学辞典」という意味をもつ。
「a dictionary of phrase and fables」とは
「a dictionary of phrase and fables」は、「故事熟語辞典」という意味をもつ。
「Oxford Dictionary」とは
『Oxford Dictionary(オックスフォード英語辞典)』は、オックスフォード大学出版局が発行する英語辞典である。OEDと略されることもある。英語の用法だけでなく、英語の歴史的発展も記述している。1857年、言語学協会によって編纂が開始され、1933年に初版が刊行された。初版は12巻と補遺1巻からなり、1989年に刊行された第2版は本体20巻と補遺3巻からなる。「dictionary」を含むその他の用語の解説
「Dictionary型」とは
「Dictionary型」は、プログラミング言語「Python」におけるデータ型の一種である。キーに対して値が設定された表のようなデータ構造のことを指す。
「dictionary」の使い方・例文
「dictionary」を用いた例文には、「They revised a dictionary(彼らは辞書を改訂した)」「This is a useful dictionary for students(これは学生に有益な辞書である)」「This new dictionary is a little thicker than that old dictionary(この新しい辞書はあの古い辞書よりも少し厚い)」「I cannot part with my dictionary(私は辞書を手放すことができない)」などがある。辞書
【英】dictionary
辞書とは、ワープロ、パソコンなどのかな漢字変換システムや翻訳ソフトなどにおいて、読みに対応する単語(漢字や熟語)などをまとめたもののことである。
辞書には読みと単語の対応の他に、単語の品詞(名詞や動詞)、活用形の情報や変換の優先順位が記録されていて、連文節で入力したかなに最適の変換候補が表示されるようになっている。
辞書ファイルには、かな漢字変換システムにもともと付属しているシステム辞書と、ユーザーが自由に単語を追加登録できるユーザー辞書の二種類がある。このうちシステム辞書には、医学や法律などの分野ごとの用語をまとめた分野別辞書(専門辞書)もあり、かな漢字変換システムに追加して使用すると、専門的な文書が効率的に入力できるようになっている。
このほかにも、郵便番号から地名に変換する「郵便番号辞書」などのように、後から追加できる辞書ファイルもある。また、欧文を扱うアプリケーションソフトにはスペルやハイフネーションをチェックするための機能やスペルチェック辞書が付属していることもある。
Dictionary コンストラクタ ()
アセンブリ: mscorlib (mscorlib.dll 内)


Dictionary 内のすべてのキーは既定の等値比較演算子に従って一意である必要があります。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。このコンストラクタは、既定のジェネリック等値比較演算子である EqualityComparer.Default を使用します。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。代わりに、comparer パラメータを受け付けるコンストラクタを使用して、IEqualityComparer ジェネリック インターフェイスの実装を指定することもできます。
![]() |
---|
コレクションのサイズを推定できる場合は、初期量を指定するコンストラクタを使用すると、Dictionary に要素を追加するときに、サイズ変更操作を何度も実行する必要がなくなります。 |

文字列キーを含む文字列の空の Dictionary を作成し、Add メソッドを使用していくつかの要素を追加するコード例を次に示します。この例では、重複するキーを追加しようとすると、Add メソッドが ArgumentException をスローすることを示します。
このコード例は、Dictionary クラスのトピックで取り上げているコード例の一部分です。
' Create a new dictionary of strings, with string keys. ' Dim openWith As New Dictionary(Of String, String) ' Add some elements to the dictionary. There are no ' duplicate keys, but some of the values are duplicates. openWith.Add("txt", "notepad.exe") openWith.Add("bmp", "paint.exe") openWith.Add("dib", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' The Add method throws an exception if the new key is ' already in the dictionary. Try openWith.Add("txt", "winword.exe") Catch Console.WriteLine("An element with Key = ""txt"" already exists.") End Try
// Create a new dictionary of strings, with string keys. // Dictionary<string, string> openWith = new Dictionary<string, string>(); // Add some elements to the dictionary. There are no // duplicate keys, but some of the values are duplicates. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // The Add method throws an exception if the new key is // already in the dictionary. try { openWith.Add("txt", "winword.exe"); } catch (ArgumentException) { Console.WriteLine("An element with Key = \"txt\" already exists."); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary ジェネリック クラス
Dictionary メンバ
System.Collections.Generic 名前空間
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary コンストラクタ

名前 | 説明 |
---|---|
Dictionary () | 空で、既定の初期量を備え、キーの型の既定の等値比較演算子を使用する、Dictionary クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
Dictionary (ジェネリック IDictionary) | 指定した IDictionary から要素をコピーして格納し、キーの型の既定の等値比較演算子を使用する、Dictionary クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
Dictionary (ジェネリック IEqualityComparer) | 空で、既定の初期量を備え、指定した IEqualityComparer を使用する、Dictionary クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
Dictionary (Int32) | 空で、指定した初期量を備え、キーの型の既定の等値比較演算子を使用する、Dictionary クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
Dictionary (ジェネリック IDictionary, ジェネリック IEqualityComparer) | 指定した IDictionary から要素をコピーして格納し、指定した IEqualityComparer を使用する、Dictionary クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
Dictionary (Int32, ジェネリック IEqualityComparer) | 空で、指定した初期量を備え、指定した IEqualityComparer を使用する、Dictionary クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
Dictionary (SerializationInfo, StreamingContext) | シリアル化したデータを使用して、Dictionary クラスの新しいインスタンスを初期化します。 |

関連項目
Dictionary ジェネリック クラスDictionary メンバ
System.Collections.Generic 名前空間
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary コンストラクタ (SerializationInfo, StreamingContext)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim info As SerializationInfo Dim context As StreamingContext Dim instance As New Dictionary(Of TKey, TValue)(info, context)


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary コンストラクタ (ジェネリック IDictionary)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim dictionary As IDictionary(Of TKey, TValue) Dim instance As New Dictionary(Of TKey, TValue)(dictionary)


Dictionary 内のすべてのキーは、既定の等値比較演算子に従って一意である必要があります。同様に、元の dictionary 内のすべてのキーも、既定の等値比較演算子に従って一意である必要があります。
新しい Dictionary の初期量は、dictionary 内のすべての要素を格納できるサイズです。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。このコンストラクタは、既定のジェネリック等値比較演算子である EqualityComparer.Default を使用します。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。代わりに、comparer パラメータを受け付けるコンストラクタを使用して、IEqualityComparer ジェネリック インターフェイスの実装を指定することもできます。

Dictionary(ジェネリック IEqualityComparer) コンストラクタを使用し、並べ替えられた別のディクショナリの内容によって Dictionary を初期化する方法を次のコード例に示します。このコード例では、SortedDictionary を作成し、このディクショナリにランダムな順序でデータを読み込みます。次に、SortedDictionary を Dictionary(ジェネリック IEqualityComparer) コンストラクタに渡して、並べ替えられた Dictionary を作成します。これは、特定のポイントで静的になる並べ替えられたディクショナリを構築することが必要である場合に有用です。データを SortedDictionary から Dictionary にコピーすることにより、検索速度が向上します。
Imports System Imports System.Collections.Generic Public Class Example Public Shared Sub Main() ' Create a new sorted dictionary of strings, with string ' keys. Dim openWith As New SortedDictionary(Of String, String) ' Add some elements to the sorted dictionary. openWith.Add("txt", "notepad.exe") openWith.Add("bmp", "paint.exe") openWith.Add("dib", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' Create a Dictionary of strings with string keys, and ' initialize it with the contents of the sorted dictionary. Dim copy As New Dictionary(Of String, String)(openWith) ' List the contents of the copy. Console.WriteLine() For Each kvp As KeyValuePair(Of String, String) In copy Console.WriteLine("Key = {0}, Value = {1}", _ kvp.Key, kvp.Value) Next kvp End Sub End Class ' This code example produces the following output: ' 'Key = bmp, Value = paint.exe 'Key = dib, Value = paint.exe 'Key = rtf, Value = wordpad.exe 'Key = txt, Value = notepad.exe
using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new sorted dictionary of strings, with string // keys. SortedDictionary<string, string> openWith = new SortedDictionary<string, string>(); // Add some elements to the dictionary. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // Create a Dictionary of strings with string keys, and // initialize it with the contents of the sorted dictionary. Dictionary<string, string> copy = new Dictionary<string, string>(openWith); // List the contents of the copy. Console.WriteLine(); foreach( KeyValuePair<string, string> kvp in copy ) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); } } } /* This code example produces the following output: Key = bmp, Value = paint.exe Key = dib, Value = paint.exe Key = rtf, Value = wordpad.exe Key = txt, Value = notepad.exe */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary ジェネリック クラス
Dictionary メンバ
System.Collections.Generic 名前空間
IDictionary
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary コンストラクタ (ジェネリック IEqualityComparer)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim comparer As IEqualityComparer(Of TKey) Dim instance As New Dictionary(Of TKey, TValue)(comparer)

このコンストラクタを、StringComparer クラスによって提供される大文字と小文字を区別しない文字列比較演算子に使用して、大文字と小文字を区別しない文字列キーを持つディクショナリを作成します。
Dictionary 内のすべてのキーは指定した比較演算子に従って一意である必要があります。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。comparer が null 参照 (Visual Basic では Nothing) の場合、このコンストラクタは、既定のジェネリック等値比較演算子である EqualityComparer.Default を使用します。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。
![]() |
---|
コレクションのサイズを推定できる場合は、初期量を指定するコンストラクタを使用すると、Dictionary に要素を追加するときに、サイズ変更操作を何度も実行する必要がなくなります。 |

現在のカルチャの大文字小文字を区別しない等値比較演算子を使って Dictionary を作成するコード例を次に示します。この例では、小文字のキーを含む要素と大文字のキーを含む要素を合わせて 4 つの要素を追加します。次に、既存のキーとの違いが大文字と小文字の違いだけであるキーを含む要素の追加を試行し、結果の例外をキャッチし、エラー メッセージを表示します。最後に、ディクショナリの要素を表示します。
Imports System Imports System.Collections.Generic Public Class Example Public Shared Sub Main() ' Create a new Dictionary of strings, with string keys ' and a case-insensitive comparer for the current culture. Dim openWith As New Dictionary(Of String, String)( _ StringComparer.CurrentCultureIgnoreCase) ' Add some elements to the dictionary. openWith.Add("txt", "notepad.exe") openWith.Add("bmp", "paint.exe") openWith.Add("DIB", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' Try to add a fifth element with a key that is the same ' except for case; this would be allowed with the default ' comparer. Try openWith.Add("BMP", "paint.exe") Catch ex As ArgumentException Console.WriteLine(vbLf & "BMP is already in the dictionary.") End Try ' List the contents of the dictionary. Console.WriteLine() For Each kvp As KeyValuePair(Of String, String) In openWith Console.WriteLine("Key = {0}, Value = {1}", _ kvp.Key, kvp.Value) Next kvp End Sub End Class ' This code example produces the following output: ' 'BMP is already in the dictionary. ' 'Key = txt, Value = notepad.exe 'Key = bmp, Value = paint.exe 'Key = DIB, Value = paint.exe 'Key = rtf, Value = wordpad.exe
using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new Dictionary of strings, with string keys // and a case-insensitive comparer for the current culture. Dictionary<string, string> openWith = new Dictionary<string, string>( StringComparer.CurrentCultureIgnoreCase); // Add some elements to the dictionary. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("DIB", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // Try to add a fifth element with a key that is the same // except for case; this would be allowed with the default // comparer. try { openWith.Add("BMP", "paint.exe"); } catch (ArgumentException) { Console.WriteLine("\nBMP is already in the dictionary."); } // List the contents of the sorted dictionary. Console.WriteLine(); foreach( KeyValuePair<string, string> kvp in openWith ) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); } } } /* This code example produces the following output: BMP is already in the dictionary. Key = txt, Value = notepad.exe Key = bmp, Value = paint.exe Key = DIB, Value = paint.exe Key = rtf, Value = wordpad.exe */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary ジェネリック クラス
Dictionary メンバ
System.Collections.Generic 名前空間
IEqualityComparer
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary コンストラクタ (ジェネリック IDictionary, ジェネリック IEqualityComparer)
アセンブリ: mscorlib (mscorlib.dll 内)

Public Sub New ( _ dictionary As IDictionary(Of TKey, TValue), _ comparer As IEqualityComparer(Of TKey) _ )
Dim dictionary As IDictionary(Of TKey, TValue) Dim comparer As IEqualityComparer(Of TKey) Dim instance As New Dictionary(Of TKey, TValue)(dictionary, comparer)
public function Dictionary ( dictionary : IDictionary<TKey,TValue>, comparer : IEqualityComparer<TKey> )


このコンストラクタを、StringComparer クラスによって提供される大文字と小文字を区別しない文字列比較演算子に使用して、大文字と小文字を区別しない文字列キーを持つディクショナリを作成します。
Dictionary 内のすべてのキーは、指定した比較演算子に従って一意である必要があります。同様に、元の dictionary 内のすべてのキーも、指定した比較演算子に従って一意である必要があります。
![]() |
---|
たとえば、comparer が StringComparer クラスによって提供される大文字と小文字を区別しない文字列比較演算子の 1 つであり、dictionary が大文字と小文字を区別しない比較演算子キーを使用しない場合、キーが重複する可能性があります。 |
新しい Dictionary の初期量は、dictionary 内のすべての要素を格納できるサイズです。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。comparer が null 参照 (Visual Basic では Nothing) の場合、このコンストラクタは、既定のジェネリック等値比較演算子である EqualityComparer.Default を使用します。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。

Dictionary(ジェネリック IDictionary,ジェネリック IEqualityComparer) コンストラクタを使用し、大文字小文字を区別しないで並べ替えられた別のディクショナリの内容によって Dictionary を初期化する方法を次のコード例に示します。このコード例では、大文字小文字を区別しない比較演算子を使って SortedDictionary を作成し、このディクショナリにランダムな順序でデータを読み込みます。次に、大文字小文字を区別しない等値比較演算子と共に SortedDictionary を Dictionary(ジェネリック IDictionary,ジェネリック IEqualityComparer) コンストラクタに渡して、並べ替えられた Dictionary を作成します。これは、特定のポイントで静的になる並べ替えられたディクショナリを構築することが必要である場合に有用です。データを SortedDictionary から Dictionary にコピーすることにより、検索速度が向上します。
![]() |
---|
この例のように、大文字と小文字を区別しない比較演算子を使用する新しいディクショナリを作成し、それに大文字と小文字を区別する比較演算子を使用するディクショナリのエントリを読み込む場合、入力ディクショナリに大文字と小文字が違うだけのキーがあると例外が発生します。 |
Imports System Imports System.Collections.Generic Public Class Example Public Shared Sub Main() ' Create a new sorted dictionary of strings, with string ' keys and a case-insensitive comparer. Dim openWith As New SortedDictionary(Of String, String)( _ StringComparer.CurrentCultureIgnoreCase) ' Add some elements to the sorted dictionary. openWith.Add("txt", "notepad.exe") openWith.Add("Bmp", "paint.exe") openWith.Add("DIB", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' Create a Dictionary of strings with string keys and a ' case-insensitive equality comparer, and initialize it ' with the contents of the sorted dictionary. Dim copy As New Dictionary(Of String, String)(openWith, _ StringComparer.CurrentCultureIgnoreCase) ' List the contents of the copy. Console.WriteLine() For Each kvp As KeyValuePair(Of String, String) In copy Console.WriteLine("Key = {0}, Value = {1}", _ kvp.Key, kvp.Value) Next kvp End Sub End Class ' This code example produces the following output: ' 'Key = Bmp, Value = paint.exe 'Key = DIB, Value = paint.exe 'Key = rtf, Value = wordpad.exe 'Key = txt, Value = notepad.exe
using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new sorted dictionary of strings, with string // keys and a case-insensitive comparer. SortedDictionary<string, string> openWith = new SortedDictionary<string, string>( StringComparer.CurrentCultureIgnoreCase); // Add some elements to the dictionary. openWith.Add("txt", "notepad.exe"); openWith.Add("Bmp", "paint.exe"); openWith.Add("DIB", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // Create a Dictionary of strings with string keys and a // case-insensitive equality comparer, and initialize it // with the contents of the sorted dictionary. Dictionary<string, string> copy = new Dictionary<string, string>(openWith, StringComparer.CurrentCultureIgnoreCase); // List the contents of the copy. Console.WriteLine(); foreach( KeyValuePair<string, string> kvp in copy ) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); } } } /* This code example produces the following output: Key = Bmp, Value = paint.exe Key = DIB, Value = paint.exe Key = rtf, Value = wordpad.exe Key = txt, Value = notepad.exe */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary ジェネリック クラス
Dictionary メンバ
System.Collections.Generic 名前空間
IDictionary
IEqualityComparer
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary コンストラクタ (Int32, ジェネリック IEqualityComparer)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim capacity As Integer Dim comparer As IEqualityComparer(Of TKey) Dim instance As New Dictionary(Of TKey, TValue)(capacity, comparer)


このコンストラクタを、StringComparer クラスによって提供される大文字と小文字を区別しない文字列比較演算子に使用して、大文字と小文字を区別しない文字列キーを持つディクショナリを作成します。
Dictionary 内のすべてのキーは指定した比較演算子に従って一意である必要があります。
Dictionary の容量は、サイズ変更が必要になる前に Dictionary に追加できる要素の数です。Dictionary に要素を追加すると、必要に応じて、内部の配列の再割り当てによって容量が自動的に増加します。
コレクションのサイズを推定できる場合は、初期量を指定すると、Dictionary に要素を追加するときに、サイズ変更操作を何度も実行する必要がなくなります。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。comparer が null 参照 (Visual Basic では Nothing) の場合、このコンストラクタは、既定のジェネリック等値比較演算子である EqualityComparer.Default を使用します。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。

初期量 5 で、現在のカルチャの大文字小文字を区別しない等値比較演算子を使って Dictionary を作成するコード例を次に示します。この例では、小文字のキーを含む要素と大文字のキーを含む要素を合わせて 4 つの要素を追加します。次に、既存のキーとの違いが大文字と小文字の違いだけであるキーを含む要素の追加を試行し、結果の例外をキャッチし、エラー メッセージを表示します。最後に、ディクショナリの要素を表示します。
Imports System Imports System.Collections.Generic Public Class Example Public Shared Sub Main() ' Create a new Dictionary of strings, with string keys, an ' initial capacity of 5, and a case-insensitive equality ' comparer. Dim openWith As New Dictionary(Of String, String)(5, _ StringComparer.CurrentCultureIgnoreCase) ' Add 4 elements to the dictionary. openWith.Add("txt", "notepad.exe") openWith.Add("bmp", "paint.exe") openWith.Add("DIB", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' Try to add a fifth element with a key that is the same ' except for case; this would be allowed with the default ' comparer. Try openWith.Add("BMP", "paint.exe") Catch ex As ArgumentException Console.WriteLine(vbLf & "BMP is already in the dictionary.") End Try ' List the contents of the dictionary. Console.WriteLine() For Each kvp As KeyValuePair(Of String, String) In openWith Console.WriteLine("Key = {0}, Value = {1}", _ kvp.Key, kvp.Value) Next kvp End Sub End Class ' This code example produces the following output: ' 'BMP is already in the dictionary. ' 'Key = txt, Value = notepad.exe 'Key = bmp, Value = paint.exe 'Key = DIB, Value = paint.exe 'Key = rtf, Value = wordpad.exe
using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new dictionary of strings, with string keys, an // initial capacity of 5, and a case-insensitive equality // comparer. Dictionary<string, string> openWith = new Dictionary<string, string>(5, StringComparer.CurrentCultureIgnoreCase); // Add 4 elements to the dictionary. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("DIB", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // Try to add a fifth element with a key that is the same // except for case; this would be allowed with the default // comparer. try { openWith.Add("BMP", "paint.exe"); } catch (ArgumentException) { Console.WriteLine("\nBMP is already in the dictionary."); } // List the contents of the dictionary. Console.WriteLine(); foreach( KeyValuePair<string, string> kvp in openWith ) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); } } } /* This code example produces the following output: BMP is already in the dictionary. Key = txt, Value = notepad.exe Key = bmp, Value = paint.exe Key = DIB, Value = paint.exe Key = rtf, Value = wordpad.exe */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary ジェネリック クラス
Dictionary メンバ
System.Collections.Generic 名前空間
IEqualityComparer
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary コンストラクタ (Int32)
アセンブリ: mscorlib (mscorlib.dll 内)



Dictionary 内のすべてのキーは既定の等値比較演算子に従って一意である必要があります。
Dictionary の容量は、サイズ変更が必要になる前に Dictionary に追加できる要素の数です。Dictionary に要素を追加すると、必要に応じて、内部の配列の再割り当てによって容量が自動的に増加します。
コレクションのサイズを推定できる場合は、初期量を指定すると、Dictionary に要素を追加するときに、サイズ変更操作を何度も実行する必要がなくなります。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。このコンストラクタは、既定のジェネリック等値比較演算子である EqualityComparer.Default を使用します。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。代わりに、comparer パラメータを受け付けるコンストラクタを使用して、IEqualityComparer ジェネリック インターフェイスの実装を指定することもできます。

ディクショナリを初期量 4 で作成し、4 つのエントリを設定するコード例を次に示します。
Imports System Imports System.Collections.Generic Public Class Example Public Shared Sub Main() ' Create a new dictionary of strings, with string keys and ' an initial capacity of 4. Dim openWith As New Dictionary(Of String, String)(4) ' Add 4 elements to the dictionary. openWith.Add("txt", "notepad.exe") openWith.Add("bmp", "paint.exe") openWith.Add("dib", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' List the contents of the dictionary. Console.WriteLine() For Each kvp As KeyValuePair(Of String, String) In openWith Console.WriteLine("Key = {0}, Value = {1}", _ kvp.Key, kvp.Value) Next kvp End Sub End Class ' This code example produces the following output: ' 'Key = txt, Value = notepad.exe 'Key = bmp, Value = paint.exe 'Key = dib, Value = paint.exe 'Key = rtf, Value = wordpad.exe
using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new dictionary of strings, with string keys and // an initial capacity of 4. Dictionary<string, string> openWith = new Dictionary<string, string>(4); // Add 4 elements to the dictionary. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // List the contents of the dictionary. Console.WriteLine(); foreach( KeyValuePair<string, string> kvp in openWith ) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); } } } /* This code example produces the following output: Key = txt, Value = notepad.exe Key = bmp, Value = paint.exe Key = dib, Value = paint.exe Key = rtf, Value = wordpad.exe */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary ジェネリック クラス
Dictionary メンバ
System.Collections.Generic 名前空間
EqualityComparer.Default
IEquatable ジェネリック インターフェイス
Dictionary ジェネリック クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(False)> _ Public Class Dictionary(Of TKey, TValue) Implements IDictionary(Of TKey, TValue), ICollection(Of KeyValuePair(Of TKey, TValue)), _ IEnumerable(Of KeyValuePair(Of TKey, TValue)), IDictionary, ICollection, _ IEnumerable, ISerializable, IDeserializationCallback
[SerializableAttribute] [ComVisibleAttribute(false)] public class Dictionary<TKey,TValue> : IDictionary<TKey,TValue>, ICollection<KeyValuePair<TKey,TValue>>, IEnumerable<KeyValuePair<TKey,TValue>>, IDictionary, ICollection, IEnumerable, ISerializable, IDeserializationCallback
[SerializableAttribute] [ComVisibleAttribute(false)] generic<typename TKey, typename TValue> public ref class Dictionary : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable, ISerializable, IDeserializationCallback
- TValue
ディクショナリ内の値の型。

Dictionary ジェネリック クラスにより、キーのセットを値のセットに対応付けることができます。ディクショナリに追加される各エントリは、値とその値に関連付けられたキーで構成されます。Dictionary クラスはハッシュ テーブルとして実装されているため、キーを使用した値の取得は非常に高速で、O(1) に近くなります。
![]() |
---|
オブジェクトが Dictionary のキーとして使用されている場合、そのオブジェクトに対してハッシュ値に影響するような変更を行わないでください。Dictionary 内のすべてのキーは、ディクショナリの等値比較演算子に従って、一意である必要があります。キーを null 参照 (Visual Basic では Nothing) にすることはできませんが、値の型 TValue が参照型である場合、値を null にすることはできます。
Dictionary は、キーが同じであるかどうかを確認するための等値比較の実装を必要とします。comparer パラメータを受け付けるコンストラクタを使用して、IEqualityComparer ジェネリック インターフェイスの実装を指定できます。実装を指定しない場合は、既定のジェネリック等値比較演算子である EqualityComparer.Default が使用されます。型 TKey が System.IEquatable ジェネリック インターフェイスを実装している場合は、既定の等値比較演算子でその実装が使用されます。
![]() |
---|
たとえば、StringComparer クラスによって提供される大文字と小文字を区別しない文字列比較演算子を使用して、大文字と小文字を区別しない文字列キーを持つディクショナリを作成できます。 |
Dictionary の容量は、Dictionary が保持できる要素数になります。この実装では、Dictionary の既定の初期量は 3 ですが、この既定値は将来の .NET Framework のバージョンで変更される可能性があります。Dictionary に要素を追加すると、必要に応じて、内部の配列の再割り当てによって容量が自動的に増加します。
列挙処理のために、ディクショナリ内の各アイテムは、値とそのキーを表す KeyValuePair 構造体として処理されます。アイテムが返される順序は未定義です。
C# 言語の foreach ステートメント (C++ の場合は for each、Visual Basic の場合は For Each) は、コレクション内の各要素の型を必要とします。Dictionary はキーと値のコレクションであるため、要素の型は、キーの型や値の型にはなりません。代わりに、要素の型は、キーの型および値の型の KeyValuePair になります。次に例を示します。
foreach ステートメントは、列挙子のラッパーです。これは、コレクションからの読み取りだけを許可し、コレクションへの書き込みはできません。

文字列キーを含む文字列の空の Dictionary を作成し、Add メソッドを使用していくつかの要素を追加するコード例を次に示します。この例では、重複するキーを追加しようとすると、Add メソッドが ArgumentException をスローすることを示します。
この例では、Item プロパティ (C# ではインデクサ) を使用して値を取得し、要求されたキーが存在しないときに KeyNotFoundException がスローされる例を示し、またキーに関連付けられた値を置き換えることができることも示します。
この例では、プログラムがディクショナリにないキー値を頻繁に試行する必要がある場合に、より効率的に値を取得する方法として TryGetValue メソッドを使用する方法、および ContainsKey メソッドを使用して、Add メソッドを呼び出す前に、キーが存在するかどうかをテストする方法を示します。
この例では、ディクショナリのキーと値を列挙する方法、および Keys プロパティと Values プロパティを使用してキーと値のみを列挙する方法を示します。
Imports System Imports System.Collections.Generic Public Class Example Public Shared Sub Main() ' Create a new dictionary of strings, with string keys. ' Dim openWith As New Dictionary(Of String, String) ' Add some elements to the dictionary. There are no ' duplicate keys, but some of the values are duplicates. openWith.Add("txt", "notepad.exe") openWith.Add("bmp", "paint.exe") openWith.Add("dib", "paint.exe") openWith.Add("rtf", "wordpad.exe") ' The Add method throws an exception if the new key is ' already in the dictionary. Try openWith.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}.", _ openWith("rtf")) ' The default Item property can be used to change the value ' associated with a key. openWith("rtf") = "winword.exe" Console.WriteLine("For key = ""rtf"", value = {0}.", _ openWith("rtf")) ' If a key does not exist, setting the default Item property ' for that key adds a new key/value pair. openWith("doc") = "winword.exe" ' The default Item property throws an exception if the requested ' key is not in the dictionary. Try Console.WriteLine("For key = ""tif"", value = {0}.", _ openWith("tif")) Catch Console.WriteLine("Key = ""tif"" is not found.") End Try ' When a program often has to try keys that turn out not to ' be in the dictionary, TryGetValue can be a more efficient ' way to retrieve values. Dim value As String = "" If openWith.TryGetValue("tif", value) Then Console.WriteLine("For key = ""tif"", value = {0}.", value) Else Console.WriteLine("Key = ""tif"" is not found.") End If ' ContainsKey can be used to test keys before inserting ' them. If Not openWith.ContainsKey("ht") Then openWith.Add("ht", "hypertrm.exe") Console.WriteLine("Value added for key = ""ht"": {0}", _ openWith("ht")) End If ' When you use foreach to enumerate dictionary elements, ' the elements are retrieved as KeyValuePair objects. Console.WriteLine() For Each kvp As KeyValuePair(Of String, String) In openWith Console.WriteLine("Key = {0}, Value = {1}", _ kvp.Key, kvp.Value) Next kvp ' To get the values alone, use the Values property. Dim valueColl As _ Dictionary(Of String, String).ValueCollection = _ openWith.Values ' The elements of the ValueCollection are strongly typed ' with the type that was specified for dictionary values. Console.WriteLine() For Each s As String In valueColl Console.WriteLine("Value = {0}", s) Next s ' To get the keys alone, use the Keys property. Dim keyColl As _ Dictionary(Of String, String).KeyCollection = _ openWith.Keys ' The elements of the KeyCollection are strongly typed ' with the type that was specified for dictionary keys. Console.WriteLine() For Each s As String In keyColl Console.WriteLine("Key = {0}", s) Next s ' Use the Remove method to remove a key/value pair. Console.WriteLine(vbLf + "Remove(""doc"")") openWith.Remove("doc") If Not openWith.ContainsKey("doc") Then Console.WriteLine("Key ""doc"" is not found.") End If End Sub End Class ' This code example produces the following output: ' 'An element with Key = "txt" already exists. 'For key = "rtf", value = wordpad.exe. 'For key = "rtf", value = winword.exe. 'Key = "tif" is not found. 'Key = "tif" is not found. 'Value added for key = "ht": hypertrm.exe ' 'Key = txt, Value = notepad.exe 'Key = bmp, Value = paint.exe 'Key = dib, Value = paint.exe 'Key = rtf, Value = winword.exe 'Key = doc, Value = winword.exe 'Key = ht, Value = hypertrm.exe ' 'Value = notepad.exe 'Value = paint.exe 'Value = paint.exe 'Value = winword.exe 'Value = winword.exe 'Value = hypertrm.exe ' 'Key = txt 'Key = bmp 'Key = dib 'Key = rtf 'Key = doc 'Key = ht ' 'Remove("doc") 'Key "doc" is not found. '
using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new dictionary of strings, with string keys. // Dictionary<string, string> openWith = new Dictionary<string, string>(); // Add some elements to the dictionary. There are no // duplicate keys, but some of the values are duplicates. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); // The Add method throws an exception if the new key is // already in the dictionary. try { openWith.Add("txt", "winword.exe"); } catch (ArgumentException) { Console.WriteLine("An element with Key = \"txt\" already exists."); } // The Item property is another name for the indexer, so you // can omit its name when accessing elements. Console.WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]); // The indexer can be used to change the value associated // with a key. openWith["rtf"] = "winword.exe"; Console.WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]); // If a key does not exist, setting the indexer for that key // adds a new key/value pair. openWith["doc"] = "winword.exe"; // The indexer throws an exception if the requested key is // not in the dictionary. try { Console.WriteLine("For key = \"tif\", value = {0}.", openWith["tif"]); } catch (KeyNotFoundException) { Console.WriteLine("Key = \"tif\" is not found."); } // When a program often has to try keys that turn out not to // be in the dictionary, TryGetValue can be a more efficient // way to retrieve values. string value = ""; if (openWith.TryGetValue("tif", out value)) { Console.WriteLine("For key = \"tif\", value = {0}.", value); } else { Console.WriteLine("Key = \"tif\" is not found."); } // ContainsKey can be used to test keys before inserting // them. if (!openWith.ContainsKey("ht")) { openWith.Add("ht", "hypertrm.exe"); Console.WriteLine("Value added for key = \"ht\": {0}", openWith["ht"]); } // When you use foreach to enumerate dictionary elements, // the elements are retrieved as KeyValuePair objects. Console.WriteLine(); foreach( KeyValuePair<string, string> kvp in openWith ) { Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); } // To get the values alone, use the Values property. Dictionary<string, string>.ValueCollection valueColl = openWith.Values; // The elements of the ValueCollection are strongly typed // with the type that was specified for dictionary values. Console.WriteLine(); foreach( string s in valueColl ) { Console.WriteLine("Value = {0}", s); } // To get the keys alone, use the Keys property. Dictionary<string, string>.KeyCollection keyColl = openWith.Keys; // The elements of the KeyCollection are strongly typed // with the type that was specified for dictionary keys. Console.WriteLine(); foreach( string s in keyColl ) { Console.WriteLine("Key = {0}", s); } // Use the Remove method to remove a key/value pair. Console.WriteLine("\nRemove(\"doc\")"); openWith.Remove("doc"); if (!openWith.ContainsKey("doc")) { Console.WriteLine("Key \"doc\" is not found."); } } } /* This code example produces the following output: An element with Key = "txt" already exists. For key = "rtf", value = wordpad.exe. For key = "rtf", value = winword.exe. Key = "tif" is not found. Key = "tif" is not found. Value added for key = "ht": hypertrm.exe Key = txt, Value = notepad.exe Key = bmp, Value = paint.exe Key = dib, Value = paint.exe Key = rtf, Value = winword.exe Key = doc, Value = winword.exe Key = ht, Value = hypertrm.exe Value = notepad.exe Value = paint.exe Value = paint.exe Value = winword.exe Value = winword.exe Value = hypertrm.exe Key = txt Key = bmp Key = dib Key = rtf Key = doc Key = ht Remove("doc") Key "doc" is not found. */

System.Collections.Generic.Dictionary

この型の public static (Visual Basic では Shared) メンバは、スレッド セーフです。すべてのインスタンス メンバがスレッド セーフになるかどうかは保証されていません。
コレクションが変更されない限り、Dictionary では、複数の読み込み操作が同時に発生しても問題ありません。ただし、コレクションの列挙処理は、本質的にはスレッド セーフな処理ではありません。まれに書き込みアクセスによって列挙処理で競合が発生する場合、列挙処理が完了するまでコレクションをロックする必要があります。コレクションに対し複数のスレッドがアクセスして読み取りや書き込みを行うことができるようにするには、独自に同期化を実装する必要があります。

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Dictionary プロパティ



関連項目
Dictionary ジェネリック クラスSystem.Collections.Generic 名前空間
IDictionary
SortedList
KeyValuePair
IEqualityComparer
Dictionary メソッド

名前 | 説明 | |
---|---|---|
![]() | Add | 指定したキーと値をディクショナリに追加します。 |
![]() | Clear | Dictionary からすべてのキーと値を削除します。 |
![]() | ContainsKey | 指定したキーが Dictionary に格納されているかどうかを判断します。 |
![]() | ContainsValue | Dictionary に特定の値が格納されているかどうかを判断します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetEnumerator | Dictionary を反復処理する列挙子を返します。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetObjectData | System.Runtime.Serialization.ISerializable インターフェイスを実装し、Dictionary インスタンスをシリアル化するために必要なデータを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | OnDeserialization | System.Runtime.Serialization.ISerializable インターフェイスを実装し、逆シリアル化が完了したときに逆シリアル化イベントを発生させます。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | Remove | 指定したキーを持つ値を Dictionary から削除します。 |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
![]() | TryGetValue | 指定したキーに関連付けられている値を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add | 指定した値を、指定したキーと共に ICollection に追加します。 |
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Contains | ICollection に特定のキーと値が格納されているかどうかを判断します。 |
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo | 指定した配列インデックスを開始位置として、KeyValuePair 型の配列に ICollection の要素をコピーします。 |
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove | ディクショナリからキーと値を削除します。 |
![]() | System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>.GetEnumerator | コレクションを反復処理する列挙子を返します。 |
![]() | System.Collections.ICollection.CopyTo | 指定した配列インデックスを開始位置として、配列に ICollection の要素をコピーします。 |
![]() | System.Collections.IDictionary.Add | 指定したキーと値をディクショナリに追加します。 |
![]() | System.Collections.IDictionary.Contains | 指定したキーの要素が IDictionary に格納されているかどうかを確認します。 |
![]() | System.Collections.IDictionary.GetEnumerator | IDictionary の IDictionaryEnumerator を返します。 |
![]() | System.Collections.IDictionary.Remove | 指定したキーを持つ要素を IDictionary から削除します。 |
![]() | System.Collections.IEnumerable.GetEnumerator | コレクションを反復処理する列挙子を返します。 |

関連項目
Dictionary ジェネリック クラスSystem.Collections.Generic 名前空間
IDictionary
SortedList
KeyValuePair
IEqualityComparer
Dictionary メンバ
Dictionary ジェネリック型で公開されるメンバを以下の表に示します。




名前 | 説明 | |
---|---|---|
![]() | Add | 指定したキーと値をディクショナリに追加します。 |
![]() | Clear | Dictionary からすべてのキーと値を削除します。 |
![]() | ContainsKey | 指定したキーが Dictionary に格納されているかどうかを判断します。 |
![]() | ContainsValue | Dictionary に特定の値が格納されているかどうかを判断します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetEnumerator | Dictionary を反復処理する列挙子を返します。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetObjectData | System.Runtime.Serialization.ISerializable インターフェイスを実装し、Dictionary インスタンスをシリアル化するために必要なデータを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | OnDeserialization | System.Runtime.Serialization.ISerializable インターフェイスを実装し、逆シリアル化が完了したときに逆シリアル化イベントを発生させます。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | Remove | 指定したキーを持つ値を Dictionary から削除します。 |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
![]() | TryGetValue | 指定したキーに関連付けられている値を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add | 指定した値を、指定したキーと共に ICollection に追加します。 |
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Contains | ICollection に特定のキーと値が格納されているかどうかを判断します。 |
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo | 指定した配列インデックスを開始位置として、KeyValuePair 型の配列に ICollection の要素をコピーします。 |
![]() | System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove | ディクショナリからキーと値を削除します。 |
![]() | System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>.GetEnumerator | コレクションを反復処理する列挙子を返します。 |
![]() | System.Collections.ICollection.CopyTo | 指定した配列インデックスを開始位置として、配列に ICollection の要素をコピーします。 |
![]() | System.Collections.IDictionary.Add | 指定したキーと値をディクショナリに追加します。 |
![]() | System.Collections.IDictionary.Contains | 指定したキーの要素が IDictionary に格納されているかどうかを確認します。 |
![]() | System.Collections.IDictionary.GetEnumerator | IDictionary の IDictionaryEnumerator を返します。 |
![]() | System.Collections.IDictionary.Remove | 指定したキーを持つ要素を IDictionary から削除します。 |
![]() | System.Collections.IEnumerable.GetEnumerator | コレクションを反復処理する列挙子を返します。 |
![]() | System.Collections.IDictionary.Values | IDictionary 内の値を格納している ICollection を取得します。 |

関連項目
Dictionary ジェネリック クラスSystem.Collections.Generic 名前空間
IDictionary
SortedList
KeyValuePair
IEqualityComparer
辞書 (線形計画における)
- Dictionaryのページへのリンク