ActionBlock<TInput> Class
Updated: October 7, 2015
Provides a dataflow block that invokes a provided Action<T> delegate for every data element received.
Assembly: System.Threading.Tasks.Dataflow (in System.Threading.Tasks.Dataflow.dll)
| Name | Description | |
|---|---|---|
![]() | ActionBlock<TInput>(Action<TInput>^) | Initializes a new instance of the ActionBlock<TInput> class with the specified action. |
![]() | ActionBlock<TInput>(Action<TInput>^, ExecutionDataflowBlockOptions^) | Initializes a new instance of the ActionBlock<TInput> class with the specified action and configuration options. |
![]() | ActionBlock<TInput>(Func<TInput, Task^>^) | Initializes a new instance of the ActionBlock<TInput> class with the specified action. |
![]() | ActionBlock<TInput>(Func<TInput, Task^>^, ExecutionDataflowBlockOptions^) | Initializes a new instance of the ActionBlock<TInput> class with the specified action and configuration options. |
| Name | Description | |
|---|---|---|
![]() | Completion | Gets a Task object that represents the asynchronous operation and completion of the dataflow block. |
![]() | InputCount | Gets the number of input items waiting to be processed by this block. |
| Name | Description | |
|---|---|---|
![]() | Complete() | Signals to the dataflow block that it shouldn't accept or produce any more messages and shouldn't consume any more postponed messages. |
![]() | Equals(Object^) | (Inherited from Object.) |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetType() | (Inherited from Object.) |
![]() | Post(TInput) | Posts an item to the target dataflow block. |
![]() | ToString() | Returns a string that represents the formatted name of this IDataflowBlock instance.(Overrides Object::ToString().) |
| Name | Description | |
|---|---|---|
![]() ![]() | IDataflowBlock::Fault(Exception^) | Causes the dataflow block to complete in a faulted state. |
![]() ![]() | ITargetBlock<TInput>::OfferMessage(DataflowMessageHeader, TInput, ISourceBlock<TInput>^, Boolean) | Offers a message to the dataflow block, and gives it the opportunity to consume or postpone the message. |
| Name | Description | |
|---|---|---|
![]() | AsObserver<TInput>() | Creates a new IObserver<T> abstraction over the ITargetBlock<TInput>. (Defined by DataflowBlock.) |
![]() | Post<TInput>(TInput) | Posts an item to the ITargetBlock<TInput>.(Defined by DataflowBlock.) |
![]() | SendAsync<TInput>(TInput) | Overloaded. Asynchronously offers a message to the target message block, allowing for postponement.(Defined by DataflowBlock.) |
![]() | SendAsync<TInput>(TInput, CancellationToken) | Overloaded. Asynchronously offers a message to the target message block, allowing for postponement.(Defined by DataflowBlock.) |
Note |
|---|
The TPL Dataflow Library (System.Threading.Tasks.Dataflow namespace) is not distributed with the net_v45. To install the System.Threading.Tasks.Dataflow namespace, open your project in Visual Studio 2012, choose Manage NuGet Packages from the Project menu, and search online for the Microsoft.Tpl.Dataflow package. |
The following example shows the use of the ActionBlock<TInput> class to perform several computations using dataflow blocks, and returns the elapsed time required to perform the computations. This code example is part of a larger example provided for the How to: Specify the Degree of Parallelism in a Dataflow Block topic.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.




