OrderedDictionary.Count プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > OrderedDictionary.Count プロパティの意味・解説 

OrderedDictionary.Count プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

OrderedDictionary コレクションに格納されているキー/値ペアの数を取得します。

名前空間: System.Collections.Specialized
アセンブリ: System (system.dll 内)
構文構文

使用例使用例

OrderedDictionary コレクションの変更方法を示すコード例を次に示します。この例では、Count プロパティを使用して、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");
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
OrderedDictionary クラス
OrderedDictionary メンバ
System.Collections.Specialized 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

OrderedDictionary.Count プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



OrderedDictionary.Count プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS