IImmutableSet<T>.TryGetValue(T, T) 方法

定义

确定集是否包含指定的值。Determines whether the set contains a specified value.

public:
 bool TryGetValue(T equalValue, [Runtime::InteropServices::Out] T % actualValue);
public bool TryGetValue (T equalValue, out T actualValue);
abstract member TryGetValue : 'T * 'T -> bool
Public Function TryGetValue (equalValue As T, ByRef actualValue As T) As Boolean

参数

equalValue
T

要搜索的值。The value to search for.

actualValue
T

集内的匹配值(如果已找到);如果未找到匹配项,则为 equalvalueThe matching value from the set, if found, or equalvalue if there are no matches.

返回

Boolean

如果找到了匹配值,则为 true;否则为 falsetrue if a matching value was found; otherwise, false.

注解

下面是一些 TryGetValue 可能有用的方案:Following are some scenarios where TryGetValue may be useful:

  • 需要重用以前存储的对象引用,而不是创建新引用。You want to reuse a previously stored object reference instead of creating a new reference.

  • 要检索有关对象的更完整数据You want to retrieve more complete data about an object

适用于