ImmutableSortedSet<T>.TryGetValue(T, T) 方法
定义
在集内搜索给定的值,并返回所找到的相等值(如果有)。Searches the set for a given value and returns the equal value it finds, if any.
public:
virtual bool TryGetValue(T equalValue, [Runtime::InteropServices::Out] T % actualValue);
public bool TryGetValue (T equalValue, out T actualValue);
abstract member TryGetValue : 'T * 'T -> bool
override this.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
搜索操作在集内找到的值;如果搜索操作未生成任何匹配项,则返回原始值。The value from the set that the search found, or the original value if the search yielded no match.
返回
一个指示搜索是否成功的值。A value indicating whether the search was successful.
实现
注解
当你想要重用以前存储的引用而不是新 (构造的引用时,这可能很有用,因为它们的比较器函数指示它们是相等的,因此,可能会出现更多的引用共享) 或查找具有更完整数据的值。This can be useful when you want to reuse a previously stored reference instead of a newly constructed one (so that more sharing of references can occur) or to look up a value that has more complete data than the value you currently have, although their comparer functions indicate they are equal.
System.object NuGet 包System.Collections.Immutable NuGet package
关于不可变集合以及如何安装About immutable collections and how to install