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

SortedList 内のキーを格納している IList。

IList 内のキーの順序は、SortedList 内での順序と同じです。
返される IList は静的なコピーではありません。代わりに、この IList は、元の SortedList のキーを参照します。そのため、SortedList に対する変更は、IList にも反映されます。
Keys プロパティによって返されるコレクションを使用すると、キーを効率的にインデックスで取得できます。リストはキーの内部配列の単なるラッパーなので、プロパティへのアクセス時にリストを再生成する必要はありません。Keys プロパティを使用して、文字列キーを持つ要素の並べ替えられたリストのキーをインデックスで取得するコード例を次に示します。

Keys プロパティを使用して並べ替えられたリストのキーを列挙する方法、および並べ替えられたリストのキーおよび値を列挙する方法を次のコード例に示します。
この例では、Keys プロパティを使用して、キーをインデックスで効率的に取得する方法も示します。
このコードは、コンパイルして実行することのできる例の一部です。詳細については、SortedList のトピックを参照してください。
' To get the keys alone, use the Keys property. Dim ilistKeys As IList(Of String) = openWith.Keys ' The elements of the list are strongly typed with the ' type that was specified for the SortedList keys. Console.WriteLine() For Each s As String In ilistKeys Console.WriteLine("Key = {0}", s) Next s ' The Keys property is an efficient way to retrieve ' keys by index. Console.WriteLine(vbLf & "Indexed retrieval using the " & _ "Keys property: Keys(2) = {0}", openWith.Keys(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 keys alone, use the Keys property. IList<string> ilistKeys = openWith.Keys; // The elements of the list are strongly typed with the // type that was specified for the SortedList keys. Console.WriteLine(); foreach( string s in ilistKeys ) { Console.WriteLine("Key = {0}", s); } // The Keys property is an efficient way to retrieve // keys by index. Console.WriteLine("\nIndexed retrieval using the Keys " + "property: Keys[2] = {0}", openWith.Keys[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); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SortedList.Keys プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


ICollection は、SortedList のキーの読み取り専用ビューです。基になる SortedList が変更されると、その変更はすぐに ICollection に反映されます。
ICollection の要素は、SortedList のキーと同じ順序で並べ替えられます。

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSortedList.Keysを検索する場合は、下記のリンクをクリックしてください。

- SortedList.Keysのページへのリンク