ConcurrentDictionary<TKey,TValue>.TryGetValue(TKey, TValue) 方法

定义

尝试从 ConcurrentDictionary<TKey,TValue>中获取与指定键关联的值。

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

此方法返回时,包含 ConcurrentDictionary<TKey,TValue> 具有指定键的对象;如果操作失败,则包含该类型的默认值。

返回

如果在 /> 中找到密钥,则为 ;否则为 < a1/ >。

实现

例外

keynull

适用于

另请参阅