語言

Dictionary<TKey,TValue>.TryGetAlternateLookup<TAlternateKey> 方法

定義

獲得一個型 Dictionary<TKey,TValue> 態的實例,可用 a TAlternateKey 作為鍵而非 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) where TAlternateKey : allows ref struct;
member this.TryGetAlternateLookup : AlternateLookup -> bool
Public Function TryGetAlternateLookup(Of TAlternateKey) (ByRef lookup As Dictionary(Of TKey, TValue).AlternateLookup(Of TAlternateKey)) As Boolean

類型參數

TAlternateKey

用於查找的另一種金鑰。

參數

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

當方法回傳 true 時所建立的查詢實例,或若方法回傳 false,則不應該使用的預設實例。

傳回

true如果能建立查詢;否則,。 false

備註

字典必須使用一個比較 IAlternateEqualityComparer<TAlternate,T> 器,實現 與 TAlternateKeyTKey。 若不行,則方法返回 false。

適用於