Skip to content

StreamExtensions.ReadByteOrThrowAsync Method

Definition

Reads a single byte from the stream asynchronously, throwing EndOfStreamException if the end of the stream has been reached.

public static ValueTask<Byte> ReadByteOrThrowAsync(this Stream stream, CancellationToken cancellationToken = null);

Parameters

Name Type Description
stream Stream
cancellationToken CancellationToken A cancellation token.

Returns

ValueTask<Byte>

The byte read from the stream.