TransformManyBlock<TInput,TOutput>.TryReceive 方法

定义

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

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

参数

filter
Predicate<TOutput>

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

item
TOutput

从源中检索到的项。

返回

Boolean

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

实现

注解

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

在检查某个元素后,它将返回该元素是否可用。

适用于