DataflowBlock.ReceiveAsync DataflowBlock.ReceiveAsync DataflowBlock.ReceiveAsync DataflowBlock.ReceiveAsync Method

Definición

Sobrecargas

ReceiveAsync<TOutput>(ISourceBlock<TOutput>) ReceiveAsync<TOutput>(ISourceBlock<TOutput>) ReceiveAsync<TOutput>(ISourceBlock<TOutput>) ReceiveAsync<TOutput>(ISourceBlock<TOutput>)

Recibe de forma asincrónica un valor de un origen especificado.Asynchronously receives a value from a specified source.

ReceiveAsync<TOutput>(ISourceBlock<TOutput>, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, CancellationToken)

De forma asincrónica recibe un valor de un origen especificado y proporciona un token para cancelar la operación.Asynchronously receives a value from a specified source and provides a token to cancel the operation.

ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan)

De forma asincrónica recibe un valor de un origen especificado, observando un tiempo de espera opcional.Asynchronously receives a value from a specified source, observing an optional time-out period.

ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan, CancellationToken)

De forma asincrónica recibe un valor de un origen especificado, proporcionando un símbolo para anular la operación y observando un intervalo de tiempo de espera opcional.Asynchronously receives a value from a specified source, providing a token to cancel the operation and observing an optional time-out interval.

ReceiveAsync<TOutput>(ISourceBlock<TOutput>) ReceiveAsync<TOutput>(ISourceBlock<TOutput>) ReceiveAsync<TOutput>(ISourceBlock<TOutput>) ReceiveAsync<TOutput>(ISourceBlock<TOutput>)

Recibe de forma asincrónica un valor de un origen especificado.Asynchronously receives a value from a specified source.

public:
generic <typename TOutput>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<TOutput> ^ ReceiveAsync(System::Threading::Tasks::Dataflow::ISourceBlock<TOutput> ^ source);
public static System.Threading.Tasks.Task<TOutput> ReceiveAsync<TOutput> (this System.Threading.Tasks.Dataflow.ISourceBlock<TOutput> source);
static member ReceiveAsync : System.Threading.Tasks.Dataflow.ISourceBlock<'Output> -> System.Threading.Tasks.Task<'Output>
<Extension()>
Public Function ReceiveAsync(Of TOutput) (source As ISourceBlock(Of TOutput)) As Task(Of TOutput)

Parámetros de tipo

TOutput

El tipo de los datos contenido del origen de datos.The type of data contained in the source.

Parámetros

source
ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput>

Origen del que se va a recibir el valor.The source from which to receive the value.

Devoluciones

Task<TOutput>

Tarea que representa la operación de recepción asincrónica.A task that represents the asynchronous receive operation. Cuando un valor del elemento se recibe correctamente del origen, la tarea devuelta se completa y su Result devuelve el valor del elemento recibido.When an item value is successfully received from the source, the returned task is completed and its Result returns the received value. Si el valor de un elemento no se puede recuperar porque el origen está vacío y completo, se inicia una excepción InvalidOperationException en la tarea devuelta.If an item value cannot be retrieved because the source is empty and completed , an InvalidOperationException exception is thrown in the returned task.

Excepciones

ReceiveAsync<TOutput>(ISourceBlock<TOutput>, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, CancellationToken)

De forma asincrónica recibe un valor de un origen especificado y proporciona un token para cancelar la operación.Asynchronously receives a value from a specified source and provides a token to cancel the operation.

public:
generic <typename TOutput>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<TOutput> ^ ReceiveAsync(System::Threading::Tasks::Dataflow::ISourceBlock<TOutput> ^ source, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<TOutput> ReceiveAsync<TOutput> (this System.Threading.Tasks.Dataflow.ISourceBlock<TOutput> source, System.Threading.CancellationToken cancellationToken);
static member ReceiveAsync : System.Threading.Tasks.Dataflow.ISourceBlock<'Output> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Output>

Parámetros de tipo

TOutput

Especifica el tipo de datos contenidos en el origen.Specifies the type of data contained in the source.

Parámetros

source
ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput>

Origen del que se va a recibir el valor.The source from which to receive the value.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

El token que se va a utilizar para cancelar la selección la operación de recepción.The token to use to cancel the receive operation.

Devoluciones

Task<TOutput>

Tarea que representa la operación de recepción asincrónica.A task that represents the asynchronous receive operation. Cuando un valor se recibe correctamente desde el origen, la tarea devuelta se completa y su Result devuelve el valor.When a value is successfully received from the source, the returned task is completed and its Result returns the value. Si un valor no se puede recuperar porque se solicitó la cancelación, la tarea devuelta se cancelará.If a value cannot be retrieved because cancellation was requested, the returned task is canceled. Si el valor del elemento no se puede recuperar porque el origen está vacío y completo, se inicia una excepción InvalidOperationException en la tarea devuelta.If the value cannot be retrieved because the source is empty and completed , an InvalidOperationException exception is thrown in the returned task.

Excepciones

ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan)

De forma asincrónica recibe un valor de un origen especificado, observando un tiempo de espera opcional.Asynchronously receives a value from a specified source, observing an optional time-out period.

public:
generic <typename TOutput>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<TOutput> ^ ReceiveAsync(System::Threading::Tasks::Dataflow::ISourceBlock<TOutput> ^ source, TimeSpan timeout);
public static System.Threading.Tasks.Task<TOutput> ReceiveAsync<TOutput> (this System.Threading.Tasks.Dataflow.ISourceBlock<TOutput> source, TimeSpan timeout);
static member ReceiveAsync : System.Threading.Tasks.Dataflow.ISourceBlock<'Output> * TimeSpan -> System.Threading.Tasks.Task<'Output>
<Extension()>
Public Function ReceiveAsync(Of TOutput) (source As ISourceBlock(Of TOutput), timeout As TimeSpan) As Task(Of TOutput)

Parámetros de tipo

TOutput

El tipo de los datos contenido del origen de datos.The type of data contained in the source.

Parámetros

source
ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput>

Origen del que se va a recibir el valor.The source from which to receive the value.

timeout
TimeSpan TimeSpan TimeSpan TimeSpan

El intervalo de tiempo máximo, en milisegundos, para esperar la operación síncrona para completar, o un intervalo que representa -1 milisegundos para esperar indefinidamente.The maximum time interval, in milliseconds, to wait for the synchronous operation to complete, or an interval that represents -1 milliseconds to wait indefinitely.

Devoluciones

Task<TOutput>

Tarea que representa la operación de recepción asincrónica.A task that represents the asynchronous receive operation. Cuando un valor se recibe correctamente desde el origen, la tarea devuelta se completa y su Result devuelve el valor.When a value is successfully received from the source, the returned task is completed and its Result returns the value. Si un valor no se puede recuperar porque el tiempo de espera ha expirado, la tarea devuelta se cancelará.If a value cannot be retrieved because the time-out expired, the returned task is canceled. Si el valor del elemento no se puede recuperar porque el origen está vacío y completo, se inicia una excepción InvalidOperationException en la tarea devuelta.If the value cannot be retrieved because the source is empty and completed , an InvalidOperationException exception is thrown in the returned task.

Excepciones

timeout es un número negativo distinto de -1 milisegundo que representa un período de espera infinito.timeout is a negative number other than -1 milliseconds, which represents an infinite time-out period.

o bien-or- timeout es mayor que MaxValue.timeout is greater than MaxValue.

ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan, CancellationToken) ReceiveAsync<TOutput>(ISourceBlock<TOutput>, TimeSpan, CancellationToken)

De forma asincrónica recibe un valor de un origen especificado, proporcionando un símbolo para anular la operación y observando un intervalo de tiempo de espera opcional.Asynchronously receives a value from a specified source, providing a token to cancel the operation and observing an optional time-out interval.

public:
generic <typename TOutput>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<TOutput> ^ ReceiveAsync(System::Threading::Tasks::Dataflow::ISourceBlock<TOutput> ^ source, TimeSpan timeout, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<TOutput> ReceiveAsync<TOutput> (this System.Threading.Tasks.Dataflow.ISourceBlock<TOutput> source, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
static member ReceiveAsync : System.Threading.Tasks.Dataflow.ISourceBlock<'Output> * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Output>

Parámetros de tipo

TOutput

El tipo de los datos contenido del origen de datos.The type of data contained in the source.

Parámetros

source
ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput> ISourceBlock<TOutput>

Origen del que se va a recibir el valor.The source from which to receive the value.

timeout
TimeSpan TimeSpan TimeSpan TimeSpan

El intervalo de tiempo máximo, en milisegundos, para esperar la operación síncrona para completar, o un intervalo que representa -1 milisegundos para esperar indefinidamente.The maximum time interval, in milliseconds, to wait for the synchronous operation to complete, or an interval that represents -1 milliseconds to wait indefinitely.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

El token que se puede usar para cancelar la operación de recepción.The token which may be used to cancel the receive operation.

Devoluciones

Task<TOutput>

Tarea que representa la operación de recepción asincrónica.A task that represents the asynchronous receive operation. Cuando un valor se recibe correctamente desde el origen, la tarea devuelta se completa y su Result devuelve el valor.When a value is successfully received from the source, the returned task is completed and its Result returns the value. Si un valor no se puede recuperar porque el tiempo de espera expirado o se solicitó cancelación, la tarea devuelta se cancelará.If a value cannot be retrieved because the time-out expired or cancellation was requested, the returned task is canceled. Si el valor del elemento no se puede recuperar porque el origen está vacío y completo, se inicia una excepción InvalidOperationException en la tarea devuelta.If the value cannot be retrieved because the source is empty and completed, an InvalidOperationException exception is thrown in the returned task.

Excepciones

timeout es un número negativo distinto de -1 milisegundo que representa un período de espera infinito.timeout is a negative number other than -1 milliseconds, which represents an infinite time-out period.

O bien-or- timeout es mayor que MaxValue.timeout is greater than MaxValue.

Se aplica a