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

OrderedDictionary コレクションが読み取り専用の場合は true。それ以外の場合は false。既定値は false です。

読み取り専用のコレクションでは、コレクション作成後に要素の追加、削除、または変更はできません。
読み取り専用のコレクションは、コレクションの変更を防ぐラッパーがコレクションに組み込まれているに過ぎません。したがって、基になっているコレクションで変更が加えられた場合、読み取り専用のコレクションでもその内容が反映されます。

OrderedDictionary コレクションの変更方法を示すコード例を次に示します。この例では、IsReadOnly プロパティを使用して、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.IsReadOnly プロパティを検索する場合は、下記のリンクをクリックしてください。

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