DataflowBlock.SendAsync 메서드

정의

오버로드

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

대상 메시지 블록에 메시지를 비동기적으로 제공하며, 연기를 허용합니다.

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>입니다. Target이 SendAsync를 호출하는 동안 제공된 요소를 수락하고 사용하는 경우 호출에서 반환되면 결과가 Task<TResult> 완료되고 해당 Result 속성이 true를 반환합니다. 대상이 호출 중에 제공된 요소를 거절하는 경우 호출에서 반환되면 결과가 Task<TResult> 완료되고 해당 속성이 Result false를 반환합니다. 대상이 제공된 요소를 연기하면 대상에서 요소를 사용하거나 해제할 때까지 요소가 버퍼링되며, 이때 메시지가 사용되었는지 여부를 나타내는 작업이 완료 Result 됩니다. 대상이 메시지를 소비 또는 해제하려고 하지 않으면 반환된 작업이 절대 완료되지 않습니다.

대상이 전송된 데이터를 성공적으로 사용하기 전에 취소가 요청된 경우 반환된 작업이 취소됨 상태에서 완료되고 대상에서 해당 데이터를 더 이상 사용할 수 없습니다.

예외

target null(Visual Basic의 경우 Nothing)입니다.

취소 토큰이 취소되었습니다. 이 예외는 반환된 작업에 저장됩니다.

적용 대상

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

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와 함께 작업이 완료됩니다. 대상이 메시지를 소비 또는 해제하려고 하지 않으면 반환된 작업이 절대 완료되지 않습니다.

예외

targetnull입니다.

적용 대상