Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ChannelReader<T>.WaitToReadAsync(CancellationToken) Method

Definition

Namespace:
System.Threading.Channels
Assembly:
System.Threading.Channels.dll
Package:
System.Threading.Channels v11.0.0-preview.5.26302.115
Source:
ChannelReader.cs
Source:
ChannelReader.cs
Source:
ChannelReader.cs
Source:
ChannelReader.cs
Source:
ChannelReader.cs
Source:
ChannelReader.cs

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.

Applies to


Feedback

Was this page helpful?