Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ActionBlock<TInput> Class

 

Updated: October 7, 2015

Provides a dataflow block that invokes a provided Action<T> delegate for every data element received.

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

System::Object
System.Threading.Tasks.Dataflow::ActionBlock<TInput>

generic<typename TInput>
public ref class ActionBlock sealed : ITargetBlock<TInput>, IDataflowBlock

Type Parameters

TInput

The type of data that this ActionBlock<TInput> operates on.

NameDescription
System_CAPS_pubmethodActionBlock<TInput>(Action<TInput>^)

Initializes a new instance of the ActionBlock<TInput> class with the specified action.

System_CAPS_pubmethodActionBlock<TInput>(Action<TInput>^, ExecutionDataflowBlockOptions^)

Initializes a new instance of the ActionBlock<TInput> class with the specified action and configuration options.

System_CAPS_pubmethodActionBlock<TInput>(Func<TInput, Task^>^)

Initializes a new instance of the ActionBlock<TInput> class with the specified action.

System_CAPS_pubmethodActionBlock<TInput>(Func<TInput, Task^>^, ExecutionDataflowBlockOptions^)

Initializes a new instance of the ActionBlock<TInput> class with the specified action and configuration options.

NameDescription
System_CAPS_pubpropertyCompletion

Gets a Task object that represents the asynchronous operation and completion of the dataflow block.

System_CAPS_pubpropertyInputCount

Gets the number of input items waiting to be processed by this block.

NameDescription
System_CAPS_pubmethodComplete()

Signals to the dataflow block that it shouldn't accept or produce any more messages and shouldn't consume any more postponed messages.

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodPost(TInput)

Posts an item to the target dataflow block.

System_CAPS_pubmethodToString()

Returns a string that represents the formatted name of this IDataflowBlock instance.(Overrides Object::ToString().)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataflowBlock::Fault(Exception^)

Causes the dataflow block to complete in a faulted state.

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

NameDescription
System_CAPS_pubmethodAsObserver<TInput>()

Creates a new IObserver<T> abstraction over the ITargetBlock<TInput>. (Defined by DataflowBlock.)

System_CAPS_pubmethodPost<TInput>(TInput)

Posts an item to the ITargetBlock<TInput>.(Defined by DataflowBlock.)

System_CAPS_pubmethodSendAsync<TInput>(TInput)

Overloaded. Asynchronously offers a message to the target message block, allowing for postponement.(Defined by DataflowBlock.)

System_CAPS_pubmethodSendAsync<TInput>(TInput, CancellationToken)

Overloaded. Asynchronously offers a message to the target message block, allowing for postponement.(Defined by DataflowBlock.)

System_CAPS_noteNote

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.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2017 Microsoft