Lookup<TKey,TElement>.Item[TKey] Lookup<TKey,TElement>.Item[TKey] Lookup<TKey,TElement>.Item[TKey] Lookup<TKey,TElement>.Item[TKey] Property

Definition

Gets the collection of values indexed by the specified key.

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)

Parameters

key
TKey TKey TKey TKey

The key of the desired collection of values.

Property Value

IEnumerable<TElement>

The collection of values indexed by the specified key.

Implements

Examples

The following example demonstrates how to use Item[TKey] to index directly into a Lookup<TKey,TElement>. This code example is part of a larger example provided for the Lookup<TKey,TElement> class.

// 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)

Remarks

This indexed property provides the ability to index a specific collection of values in the Lookup<TKey,TElement> by using the following syntax: myLookup[key] in Visual C# or myLookup(key) in Visual Basic. If the key is not found in the collection, an empty sequence is returned.

Applies to