語言

ImmutableDictionary<TKey,TValue>.Builder.TryGetValue 方法

定義

傳回與指定索引鍵相關聯的值。

public:
 virtual bool TryGetValue(TKey key, [Runtime::InteropServices::Out] TValue % value);
public bool TryGetValue(TKey key, out TValue value);
abstract member TryGetValue : 'Key * 'Value -> bool
override this.TryGetValue : 'Key * 'Value -> bool
Public Function TryGetValue (key As TKey, ByRef value As TValue) As Boolean

參數

key
TKey

將被取回的金鑰。

value
TValue

當此方法回傳時,包含與指定鍵相關聯的值,若找到該鍵;否則,會回傳參數型別 value 的預設值。 這個參數會未初始化傳遞。

傳回

true如果實作不變字典的物件包含具有指定鍵的元素;否則,。 false

實作

例外狀況

key 為 null。

適用於