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

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

SortedDictionary.Keys プロパティ

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

SortedDictionary 内のキー格納しているコレクション取得します

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

解説解説

SortedDictionary.KeyCollection 内のキーは、Comparer プロパティに従って並べ替えられ、関連付けられている値が、Values プロパティから返された SortedDictionary.ValueCollection 内で並べ替えられている順序と同じです。

返される SortedDictionary.KeyCollection静的コピーではありません。代わりに、この SortedDictionary.KeyCollection は、元の SortedDictionaryキー参照します。そのため、SortedDictionary対す変更は、SortedDictionary.KeyCollection にも反映されます。

このプロパティ値を取得することは、O(1) 操作なります

使用例使用例

Keys プロパティ使用してディクショナリのキー列挙する方法、およびディクショナリのキーおよび値を列挙する方法次のコード例示します

このコードは、コンパイルして実行することのできる例の一部です。詳細については、SortedDictionaryトピック参照してください

        ' To get the keys alone, use the Keys property.
        Dim keyColl _
            As SortedDictionary(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
<br /><span space="preserve">...</span><br
 />        ' 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 keys alone, use the Keys property.
        SortedDictionary<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);
        }
<br /><span space="preserve">...</span><br /> 
       // 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);
        }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SortedDictionary ジェネリック クラス
SortedDictionary メンバ
System.Collections.Generic 名前空間
SortedDictionary.KeyCollection
Values


このページでは「.NET Framework クラス ライブラリ リファレンス」からSortedDictionary.Keys プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSortedDictionary.Keys プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSortedDictionary.Keys プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SortedDictionary.Keys プロパティ」の関連用語

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

   

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



SortedDictionary.Keys プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS