Note

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

Access to this page requires authorization. You can try .

ChannelReader<T>.ReadAsync(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.

Asynchronously reads an item from the channel.

public virtual System.Threading.Tasks.ValueTask<T> ReadAsync(System.Threading.CancellationToken cancellationToken = default);
abstract member ReadAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T>
override this.ReadAsync : System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T>
Public Overridable Function ReadAsync (Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T)

Parameters

cancellationToken
CancellationToken

A CancellationToken used to cancel the read operation.

Returns

A ValueTask<TResult> that represents the asynchronous read operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

If the operation is canceled, the operation will not have removed an item from the channel.

Applies to


Feedback

Was this page helpful?