JoinBlock<T1,T2>.TryReceive 方法

定义

IReceivableSourceBlock<TOutput> 中尝试同步接收可用输出项。

public:
 virtual bool TryReceive(Predicate<Tuple<T1, T2> ^> ^ filter, [Runtime::InteropServices::Out] Tuple<T1, T2> ^ % item);
public bool TryReceive (Predicate<Tuple<T1,T2>> filter, out Tuple<T1,T2> item);
public bool TryReceive (Predicate<Tuple<T1,T2>>? filter, out Tuple<T1,T2>? item);
abstract member TryReceive : Predicate<'T1 * 'T2> * Tuple -> bool
override this.TryReceive : Predicate<'T1 * 'T2> * Tuple -> bool
Public Function TryReceive (filter As Predicate(Of Tuple(Of T1, T2)), ByRef item As Tuple(Of T1, T2)) As Boolean

参数

filter
Predicate<Tuple<T1,T2>>

为使值得到检索,必须成功传递值的谓词。 filter 可能是 null ,在此情况下,所有项均将通过。

item
Tuple<T1,T2>

从源中检索到的项。

返回

如果可以接收项,则为 true,否则为 false

注解

此方法不会阻止等待源提供项。

无论元素是否可用,它都会在检查元素后返回。

适用于