You need to wait for the completion in the TPL Dataflow DataflowBlock.NullTarget <T>

Questions like this:

TPL Dataflow, how do I forward elements to only one specific target block from many related target blocks?

suggest using DataflowBlock.NullTarget {T} to remove items from the pipeline, for example

forwarder.LinkTo(DataflowBlock.NullTarget<SomeType>());

However, if you use NullTarget, how is it, how do you wait for completion? It would not be better to create a drop block:

ITargetBlock<SomeType> discard = DataflowBlock.NullTarget<SomeType>();
forwarder.LinkTo(discard);

and wait for completion? i.e.

discard.Completion.Wait()

Or you do not need to wait for the completion of the "NullTarget" block, i.e. Is it easy to throw it away and forget it?

+3
source share
1 answer

, Completion NullTarget , Complete() Fault() .

, NullTarget, .

+3

All Articles