DataflowBlock.SendAsync<TInput> Method (ITargetBlock<TInput>, TInput)
Asynchronously offers a message to the target message block, allowing for postponement.
Assembly: System.Threading.Tasks.Dataflow (in System.Threading.Tasks.Dataflow.dll)
public static Task<bool> SendAsync<TInput>( this ITargetBlock<TInput> target, TInput item )
Specifies the type of the data to post to the target.
- Type: System.Threading.Tasks.Dataflow.ITargetBlock<>
The target to which to post the data.
The item being offered to the target.
Return ValueType: System.Threading.Tasks.Task<Boolean>
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.
Usage NoteIn Visual Basic and C#, you can call this method as an instance method on any object of type ITargetBlock<>. 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).
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.