OrderedDictionary.Insert メソッド
アセンブリ: System (system.dll 内)

Dim instance As OrderedDictionary Dim index As Integer Dim key As Object Dim value As Object instance.Insert(index, key, value)

index パラメータと OrderedDictionary コレクション内の要素数が等しい場合は、key パラメータと value パラメータがコレクションの末尾に追加されます。
新しいエントリを挿入できるように、挿入位置より後のエントリが繰り下げられ、繰り下げられたエントリのインデックスも更新されます。

OrderedDictionary コレクションの変更方法を示すコード例を次に示します。この例では、Insert メソッドを使用して、OrderedDictionary の先頭に新しいエントリを追加し、それ以降のエントリを繰り下げます。このコードは、OrderedDictionary で参照できるコード例の一部です。
' Modifying the OrderedDictionary If Not myOrderedDictionary.IsReadOnly Then ' Insert a new key to the beginning of the OrderedDictionary myOrderedDictionary.Insert(0, "insertedKey1", "insertedValue1") ' Modify the value of the entry with the key "testKey2" myOrderedDictionary("testKey2") = "modifiedValue" ' Remove the last entry from the OrderedDictionary: "testKey3" myOrderedDictionary.RemoveAt(myOrderedDictionary.Count - 1) ' Remove the "keyToDelete" entry, if it exists If (myOrderedDictionary.Contains("keyToDelete")) Then myOrderedDictionary.Remove("keyToDelete") End If End If
// Modifying the OrderedDictionary if (!myOrderedDictionary.IsReadOnly) { // Insert a new key to the beginning of the OrderedDictionary myOrderedDictionary.Insert(0, "insertedKey1", "insertedValue1"); // Modify the value of the entry with the key "testKey2" myOrderedDictionary["testKey2"] = "modifiedValue"; // Remove the last entry from the OrderedDictionary: "testKey3" myOrderedDictionary.RemoveAt(myOrderedDictionary.Count - 1); // Remove the "keyToDelete" entry, if it exists if (myOrderedDictionary.Contains("keyToDelete")) { myOrderedDictionary.Remove("keyToDelete"); } }

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.Insert メソッドを検索する場合は、下記のリンクをクリックしてください。

- OrderedDictionary.Insert メソッドのページへのリンク