OrderedDictionary.Values プロパティ
アセンブリ: System (system.dll 内)

OrderedDictionary コレクションの値を保持している ICollection オブジェクト。

返される ICollection オブジェクトは静的なコピーではありません。代わりに、この ICollection は、元の OrderedDictionary コレクションの値を参照します。そのため、OrderedDictionary に対する変更は、ICollection にも反映されます。

OrderedDictionary コレクションを作成してデータを読み込み、内容をコンソールに出力するコード例を次に示します。この例では、内容を表示するメソッドに Keys プロパティと Values プロパティが渡されます。このコードは、OrderedDictionary で参照できるコード例の一部です。
' Creates and initializes a OrderedDictionary. Dim myOrderedDictionary As New OrderedDictionary() myOrderedDictionary.Add("testKey1", "testValue1") myOrderedDictionary.Add("testKey2", "testValue2") myOrderedDictionary.Add("keyToDelete", "valueToDelete") myOrderedDictionary.Add("testKey3", "testValue3") Dim keyCollection As ICollection = myOrderedDictionary.Keys Dim valueCollection As ICollection = myOrderedDictionary.Values ' Display the contents Imports the key and value collections DisplayContents( _ keyCollection, valueCollection, myOrderedDictionary.Count)
// Creates and initializes a OrderedDictionary. OrderedDictionary myOrderedDictionary = new OrderedDictionary(); myOrderedDictionary.Add("testKey1", "testValue1"); myOrderedDictionary.Add("testKey2", "testValue2"); myOrderedDictionary.Add("keyToDelete", "valueToDelete"); myOrderedDictionary.Add("testKey3", "testValue3"); ICollection keyCollection = myOrderedDictionary.Keys; ICollection valueCollection = myOrderedDictionary.Values; // Display the contents using the key and value collections DisplayContents(keyCollection, valueCollection, myOrderedDictionary.Count);
' Displays the contents of the OrderedDictionary from its keys and values Public Shared Sub DisplayContents( _ ByVal keyCollection As ICollection, _ ByVal valueCollection As ICollection, ByVal dictionarySize As Integer) Dim myKeys(dictionarySize) As [String] Dim myValues(dictionarySize) As [String] keyCollection.CopyTo(myKeys, 0) valueCollection.CopyTo(myValues, 0) ' Displays the contents of the OrderedDictionary Console.WriteLine(" INDEX KEY VALUE") Dim i As Integer For i = 0 To dictionarySize - 1 Console.WriteLine(" {0,-5} {1,-25} {2}", _ i, myKeys(i), myValues(i)) Next i Console.WriteLine() End Sub
// Displays the contents of the OrderedDictionary from its keys and values public static void DisplayContents( ICollection keyCollection, ICollection valueCollection, int dictionarySize) { String[] myKeys = new String[dictionarySize]; String[] myValues = new String[dictionarySize]; keyCollection.CopyTo(myKeys, 0); valueCollection.CopyTo(myValues, 0); // Displays the contents of the OrderedDictionary Console.WriteLine(" INDEX KEY VALUE"); for (int i = 0; i < dictionarySize; i++) { Console.WriteLine(" {0,-5} {1,-25} {2}", i, myKeys[i], myValues[i]); } Console.WriteLine(); }

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


Weblioに収録されているすべての辞書からOrderedDictionary.Values プロパティを検索する場合は、下記のリンクをクリックしてください。

- OrderedDictionary.Values プロパティのページへのリンク