IImmutableDictionary<TKey,TValue>.TryGetKey(TKey, TKey) 方法

定义

确定此字典是否包含指定的键。

public:
 bool TryGetKey(TKey equalKey, [Runtime::InteropServices::Out] TKey % actualKey);
public bool TryGetKey(TKey equalKey, out TKey actualKey);
abstract member TryGetKey : 'Key * 'Key -> bool
Public Function TryGetKey (equalKey As TKey, ByRef actualKey As TKey) As Boolean

参数

equalKey
TKey

要搜索的关键字。

actualKey
TKey

如果找到,或 equalkey 找不到匹配项,则位于字典中的匹配键。

返回

true 如果找到匹配项 equalKey ,则为 ;否则为 false

注解

以下是一些 TryGetKey 可能有用的情况:

  • 你想要重复使用以前存储的对象引用,而不是创建新的引用。

  • 你想要查找对象的规范值

  • 想要检索有关对象的完整数据

适用于