ChannelReader<T>.WaitToReadAsync(CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a ValueTask<TResult> that will complete when data is available to read.
public abstract System.Threading.Tasks.ValueTask<bool> WaitToReadAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member WaitToReadAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<bool>
Public MustOverride Function WaitToReadAsync (Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Boolean)
Parameters
- cancellationToken
- CancellationToken
A CancellationToken used to cancel the wait operation.
Returns
A ValueTask<TResult> that will complete with a true
result when data is available to read
or with a false
result when no further data will ever be available to be read due to the channel completing successfully.
If the channel completes with an exception, the task will also complete with an exception.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.