Rediger

Del via


DataflowBlock.Receive Method

Definition

Overloads

Receive<TOutput>(ISourceBlock<TOutput>)

Synchronously receives a value from a specified source.

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

Synchronously receives a value from a specified source and provides a token to cancel the operation.

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

Synchronously receives a value from a specified source, observing an optional time-out period.

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

Synchronously receives a value from a specified source, providing a token to cancel the operation and observing an optional time-out interval.

Receive<TOutput>(ISourceBlock<TOutput>)

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

Synchronously receives a value from a specified source.

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

Type Parameters

TOutput

The type of data contained in the source.

Parameters

source
ISourceBlock<TOutput>

The source from which to receive the value.

Returns

TOutput

The received value.

Exceptions

source is null.

No item could be received from the source.

Applies to

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

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

Synchronously receives a value from a specified source and provides a token to cancel the operation.

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

Type Parameters

TOutput

The type of data contained in the source.

Parameters

source
ISourceBlock<TOutput>

The source from which to receive the value.

cancellationToken
CancellationToken

The token to use to cancel the receive operation.

Returns

TOutput

The received value.

Exceptions

source is null.

No item could be received from the source.

The operation was canceled before an item was received from the source.

Remarks

If the source successfully offered an item that was received by this operation, that item is returned even if a concurrent cancellation request occurs.

Applies to

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

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

Synchronously receives a value from a specified source, observing an optional time-out period.

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

Type Parameters

TOutput

The type of data contained in the source.

Parameters

source
ISourceBlock<TOutput>

The source from which to receive the value.

timeout
TimeSpan

The maximum time interval, in milliseconds, to wait for the synchronous operation to complete, or an interval that represents -1 milliseconds to wait indefinitely.

Returns

TOutput

The received value.

Exceptions

timeout is a negative number other than -1 milliseconds, which represents an infinite time-out period.

-or-

timeout is greater than Int32.MaxValue.

source is null.

No item could be received from the source.

The specified time-out expired before an item was received from the source.

Remarks

If the source successfully offered an item that was received by this operation, that item is returned even if a concurrent time-out occurs.

Applies to

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

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

Synchronously 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 TOutput Receive(System::Threading::Tasks::Dataflow::ISourceBlock<TOutput> ^ source, TimeSpan timeout, System::Threading::CancellationToken cancellationToken);
public static TOutput Receive<TOutput> (this System.Threading.Tasks.Dataflow.ISourceBlock<TOutput> source, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
static member Receive : System.Threading.Tasks.Dataflow.ISourceBlock<'Output> * TimeSpan * System.Threading.CancellationToken -> 'Output
<Extension()>
Public Function Receive(Of TOutput) (source As ISourceBlock(Of TOutput), timeout As TimeSpan, cancellationToken As CancellationToken) As TOutput

Type Parameters

TOutput

The type of data contained in the source.

Parameters

source
ISourceBlock<TOutput>

The source from which to receive the value.

timeout
TimeSpan

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

The token to use to cancel the receive operation.

Returns

TOutput

The received value.

Exceptions

The source is null.

timeout is a negative number other than -1 milliseconds, which represents an infinite time-out period.

-or-

timeout is greater than Int32.MaxValue.

No item could be received from the source.

The specified time-out expired before an item was received from the source.

The operation was canceled before an item was received from the source.

Remarks

If the source successfully offered an item value that was received by this operation, that value is returned even if a concurrent time-out or cancellation request occurs.

Applies to