Breyta

Deila með


DataflowBlock.SendAsync Method

Definition

Overloads

SendAsync<TInput>(ITargetBlock<TInput>, TInput, CancellationToken)

Asynchronously offers a message to the target message block, allowing for postponement.

SendAsync<TInput>(ITargetBlock<TInput>, TInput)

Asynchronously offers a message to the target message block, allowing for postponement.

SendAsync<TInput>(ITargetBlock<TInput>, TInput, CancellationToken)

Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs

Asynchronously offers a message to the target message block, allowing for postponement.

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

Type Parameters

TInput

Specifies the type of the data to post to the target.

Parameters

target
ITargetBlock<TInput>

The target to which to post the data.

item
TInput

The item being offered to the target.

cancellationToken
CancellationToken

The cancellation token with which to request cancellation of the send operation.

Returns

A Task<TResult> that represents the asynchronous send. If the target accepts and consumes the offered element during the call to SendAsync, upon return from the call the resulting Task<TResult> will be completed and its Result property will return true. If the target declines the offered element during the call, upon return from the call the resulting Task<TResult> will be completed and its Result property will return false. If the target postpones the offered element, the element will be buffered until such time that the target consumes or releases it, at which point the Task will complete, with its Result indicating whether the message was consumed. If the target never attempts to consume or release the message, the returned task will never complete.

If cancellation is requested before the target has successfully consumed the sent data, the returned task will complete in the Canceled state and the data will no longer be available to the target.

Exceptions

The target is null (Nothing in Visual Basic).

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

SendAsync<TInput>(ITargetBlock<TInput>, TInput)

Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs
Source:
DataflowBlock.cs

Asynchronously offers a message to the target message block, allowing for postponement.

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

Type Parameters

TInput

Specifies the type of the data to post to the target.

Parameters

target
ITargetBlock<TInput>

The target to which to post the data.

item
TInput

The item being offered to the target.

Returns

A Task<TResult> that represents the asynchronous send. If the target accepts and consumes the offered element during the call to SendAsync<TInput>(ITargetBlock<TInput>, TInput), upon return from the call the resulting Task<TResult> will be completed and its Result property will return true. If the target declines the offered element during the call, upon return from the call the resulting Task<TResult> will be completed and its Result property will return false. If the target postpones the offered element, the element will be buffered until such time that the target consumes or releases it, at which point the task will complete, with its Result indicating whether the message was consumed. If the target never attempts to consume or release the message, the returned task will never complete.

Exceptions

The target is null.

Applies to