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

定義

搜尋集合中的指定值,並傳回其找到的相等值,如果有的話。

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

參數

equalValue
T

要搜尋的值。

actualValue
T

搜尋找到的集合中的值,或搜尋未匹配時的預設值 T。

傳回

一個表示搜尋是否成功的數值。

備註

當你想重用先前儲存的參考而非新建的參考(以便更多引用共享),或查找資料比目前更完整的值時,這很有用,儘管它們的比較函數顯示兩者相等。

適用於