Lookup<TKey,TElement>.Item[TKey] プロパティ

定義

指定したキーによってインデックス付けされた値のコレクションを取得します。

public:
 property System::Collections::Generic::IEnumerable<TElement> ^ default[TKey] { System::Collections::Generic::IEnumerable<TElement> ^ get(TKey key); };
public System.Collections.Generic.IEnumerable<TElement> this[TKey key] { get; }
member this.Item('Key) : seq<'Element>
Default Public ReadOnly Property Item(key As TKey) As IEnumerable(Of TElement)

パラメーター

key
TKey

目的の値のコレクションのキー。

プロパティ値

IEnumerable<TElement>

指定したキーによってインデックス付けされた値のコレクション。

実装

次の例では、 Item[] を使用して Lookup<TKey,TElement>に直接インデックスを付ける方法を示します。 このコード例は、 Lookup<TKey,TElement> クラスに提供されるより大きな例の一部です。

// Select a collection of Packages by indexing directly into the Lookup.
IEnumerable<string> cgroup = lookup['C'];
' Select a collection of Packages by indexing directly into the Lookup.
Dim cgroup As System.Collections.Generic.IEnumerable(Of String) = lookup("C"c)

注釈

このインデックス付きプロパティは、Visual C# の Lookup<TKey,TElement> または Visual Basic の myLookup[key] の構文を使用して、myLookup(key) 内の特定の値のコレクションにインデックスを付ける機能を提供します。 keyがコレクションに見つからない場合は、空のシーケンスが返されます。

適用対象