Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

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

Definition

Namespace:
System.Threading.Tasks.Dataflow
Assembly:
System.Threading.Tasks.Dataflow.dll
Package:
System.Threading.Tasks.Dataflow v11.0.0-preview.5.26302.115
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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


Feedback

Was this page helpful?