Export (0) Print
Expand All

DataflowBlock.Post<TInput> Method

.NET Framework 4.5

Posts an item to the ITargetBlock<TInput>.

Namespace:  System.Threading.Tasks.Dataflow
Assembly:  System.Threading.Tasks.Dataflow (in System.Threading.Tasks.Dataflow.dll)

public static bool Post<TInput>(
	this ITargetBlock<TInput> target,
	TInput item
)

Type Parameters

TInput

Specifies the type of data accepted by the target block.

Parameters

target
Type: System.Threading.Tasks.Dataflow.ITargetBlock<TInput>

The target block.

item
Type: TInput

The item being offered to the target.

Return Value

Type: System.Boolean
true if the item was accepted by the target block; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ITargetBlock<TInput>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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<TInput> 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.

.NET Framework

Supported in: 4.5

Portable Class Library

Supported in: Portable Class Library

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft