Muokkaa

Jaa


DataflowBlock.Post<TInput>(ITargetBlock<TInput>, TInput) Method

Definition

Posts an item to the ITargetBlock<TInput>.

public:
generic <typename TInput>
[System::Runtime::CompilerServices::Extension]
 static bool Post(System::Threading::Tasks::Dataflow::ITargetBlock<TInput> ^ target, TInput item);
public static bool Post<TInput> (this System.Threading.Tasks.Dataflow.ITargetBlock<TInput> target, TInput item);
static member Post : System.Threading.Tasks.Dataflow.ITargetBlock<'Input> * 'Input -> bool
<Extension()>
Public Function Post(Of TInput) (target As ITargetBlock(Of TInput), item As TInput) As Boolean

Type Parameters

TInput

Specifies the type of data accepted by the target block.

Parameters

target
ITargetBlock<TInput>

The target block.

item
TInput

The item being offered to the target.

Returns

true if the item was accepted by the target block; otherwise, false.

Remarks

This method will return once the target block has decided to accept or decline the item, but unless otherwise dictated by special semantics of the target block, it does not wait for the item to actually be processed. For example, ActionBlock<TInput> will return from Post as soon as it has stored the posted item into its input queue). From the perspective of the block's processing, Post is asynchronous. For target blocks that support postponing offered messages, or for blocks that may do more processing in their Post implementation, consider using SendAsync, which will return immediately and will enable the target to postpone the posted message and later consume it after SendAsync returns.

Applies to