SortedList.Valuesとは? わかりやすく解説

SortedList.Values プロパティ

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

SortedList 内の値を格納しているコレクション取得します

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

Dim instance As SortedList(Of
 TKey, TValue)
Dim value As IList(Of TValue)

value = instance.Values
public IList<TValue> Values { get; }
public:
property IList<TValue>^ Values {
    IList<TValue>^ get ();
}
/** @property */
public IList<TValue> get_Values ()

プロパティ
SortedList 内のキー格納している IList。

解説解説

IList 内の値の順序は、SortedList 内での順序と同じです。

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

Values プロパティによって返されるコレクション使用すると、値を効率的にインデックス取得できますリストは値の内部配列単なるラッパーなので、プロパティへのアクセス時にリスト再生成する必要はありません。Values プロパティ使用して文字列並べ替えられたリストの値をインデックス取得するコード例次に示します

Dim v As String = mySortedList.Values(3)
string v = mySortedList.Values[3];
String^ v = mySortedList->Values[3];

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

使用例使用例

このコード例では、Values プロパティ使用して並べ替えられたリストの値を列挙する方法、および並べ替えられたリストキーと値を列挙する方法示します

この例では、Values プロパティ使用して、値をインデックス効率的に取得する方法示します

このコード例は、SortedList クラストピック取り上げているコード例一部分です。

        ' To get the values alone, use the Values property.
        Dim ilistValues As IList(Of
 String) = openWith.Values
        
        ' The elements of the list are strongly typed with the
        ' type that was specified for the SortedList values.
        Console.WriteLine()
        For Each s As String
 In ilistValues
            Console.WriteLine("Value = {0}", s)
        Next s

        ' The Values property is an efficient way to retrieve
        ' values by index.
        Console.WriteLine(vbLf & "Indexed retrieval using
 the " & _
            "Values property: Values(2) = {0}", openWith.Values(2))
<br /><span space="preserve">...</span><br
 />        ' When you use foreach to enumerate list 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 values alone, use the Values property.
        IList<string> ilistValues = openWith.Values;

        // The elements of the list are strongly typed with the 
        // type that was specified for the SorteList values.
        Console.WriteLine();
        foreach( string s in
 ilistValues )
        {
            Console.WriteLine("Value = {0}", s);
        }

        // The Values property is an efficient way to retrieve
        // values by index.
        Console.WriteLine("\nIndexed retrieval using the
 Values " +
            "property: Values[2] = {0}", openWith.Values[2]);
<br /><span space="preserve">...</span><br /> 
       // When you use foreach to enumerate list 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);
        }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SortedList.Values プロパティ

SortedList 内の値を取得します

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

Public Overridable ReadOnly
 Property Values As ICollection
Dim instance As SortedList
Dim value As ICollection

value = instance.Values
public virtual ICollection Values { get; }
public:
virtual property ICollection^ Values {
    ICollection^ get ();
}
/** @property */
public ICollection get_Values ()

プロパティ
SortedList 内の値を格納している ICollection。

解説解説

ICollection は、SortedList の値の読み取り専用ビューです。基になる SortedList変更されると、その変更はすぐに ICollection反映されます。

ICollection要素は、SortedList の値と同じ順序並べ替えられます。

GetValueList に類似していますが、IList ではなく ICollection返します

このメソッドは O(1) 操作です。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

「SortedList.Values」の関連用語

SortedList.Valuesのお隣キーワード
検索ランキング

   

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



SortedList.Valuesのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS