Szerkesztés

Megosztás a következőn keresztül:


Dictionary<TKey,TValue>.TryGetAlternateLookup<TAlternateKey> Method

Definition

Gets an instance of a type that can be used to perform operations on the current Dictionary<TKey,TValue> using a TAlternateKey as a key instead of a TKey.

public:
generic <typename TAlternateKey>
 bool TryGetAlternateLookup([Runtime::InteropServices::Out] System::Collections::Generic::Dictionary<TKey, TValue>::AlternateLookup<TAlternateKey> % lookup);
public bool TryGetAlternateLookup<TAlternateKey> (out System.Collections.Generic.Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey> lookup);
member this.TryGetAlternateLookup : AlternateLookup -> bool
Public Function TryGetAlternateLookup(Of TAlternateKey) (ByRef lookup As Dictionary(Of TKey, TValue).AlternateLookup(Of TAlternateKey)) As Boolean

Type Parameters

TAlternateKey

The alternate type of a key for performing lookups.

Parameters

lookup
Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>

The created lookup instance when the method returns true, or a default instance that should not be used if the method returns false.

Returns

true if a lookup could be created; otherwise, false.

Remarks

The dictionary must use a comparer that implements IAlternateEqualityComparer<TAlternate,T> with TAlternateKey and TKey. If it doesn't, the method returns false.

Applies to