ImmutableDictionary<TKey,TValue>.TryGetValue(TKey, TValue) 方法
定义
获取与指定键关联的值。Gets the value associated with the specified key.
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
将检索其值的键。The key whose value will be retrieved.
- value
- TValue
当此方法返回时,如果找到该键,则包含与指定的键相关联的值;否则将包含 value 参数的类型默认值。When this method returns, contains the value associated with the specified key, if the key is found; otherwise, contains the default value for the type of the value parameter. 此参数未经初始化即被传递。This parameter is passed uninitialized.
返回
如果实现字典的对象包含具有指定键的元素,则为 true;否则为 false。true if the object that implements the dictionary contains an element with the specified key; otherwise, false.
实现
例外
key 为 null。key is null.