DataflowBlock.SendAsync 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| SendAsync<TInput>(ITargetBlock<TInput>, TInput, CancellationToken) | 
						 为目标消息块异步提供消息,允许延期。  | 
        	
| SendAsync<TInput>(ITargetBlock<TInput>, TInput) | 
						 为目标消息块异步提供消息,允许延期。  | 
        	
SendAsync<TInput>(ITargetBlock<TInput>, TInput, CancellationToken)
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
为目标消息块异步提供消息,允许延期。
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)
    类型参数
- TInput
 
指定发送到目标的数据类型。
参数
- target
 - ITargetBlock<TInput>
 
要发送数据的目标。
- item
 - TInput
 
提供给目标的项。
- cancellationToken
 - CancellationToken
 
用于请求取消发送操作的取消标记。
返回
一个表示异步发送的 Task<TResult>。  如果目标在调用 SendAsync 期间接受并使用提供的元素,则从调用返回时,将完成生成的 Task<TResult> ,并且其 Result 属性将返回 true。  如果目标在调用期间拒绝提供的元素,则从调用返回时,将完成生成的 Task<TResult> ,并且其 Result 属性将返回 false。 如果目标推迟了提供的元素,该元素将一直缓冲到目标使用或释放它的时间,此时任务将完成,其 Result 指示是否使用了消息。 如果目标从不尝试使用或释放消息,则返回的任务将无法完成。
如果在目标成功使用已发送的数据之前取消请求,则返回的任务将在“已取消”状态下完成,并且数据不再对目标可用。
例外
              target在 Visual Basic) 中为 null (Nothing。
取消令牌已取消。 此异常存储在返回的任务中。
适用于
SendAsync<TInput>(ITargetBlock<TInput>, TInput)
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
- Source:
 - DataflowBlock.cs
 
为目标消息块异步提供消息,允许延期。
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)
    类型参数
- TInput
 
指定发送到目标的数据类型。
参数
- target
 - ITargetBlock<TInput>
 
要发送数据的目标。
- item
 - TInput
 
提供给目标的项。
返回
一个表示异步发送的 Task<TResult>。 如果目标在调用 SendAsync<TInput>(ITargetBlock<TInput>, TInput) 时接受并使用提供的元素,在调用返回时Task<TResult> 将被完成,并且它的 Result 属性将返回 true。 如果目标在调用过程中拒绝提供的元素,则在调用返回时 Task<TResult> 将被完成,并且它的Result 属性将返回 false。 如果目标将提供的要素推迟,则该要素将被缓存,直到目标使用它或将其释放。此时任务宣告完成,Result 表明消息是否被使用。 如果目标从不尝试使用或释放消息,则返回的任务将无法完成。
例外
              target 为 null。