StreamExtensions.ReadByteOrThrowAsync Method ​
Definition ​
Reads a single byte from the stream asynchronously, throwing EndOfStreamException if the end of the stream has been reached.
c#
public static ValueTask<Byte> ReadByteOrThrowAsync(this Stream stream, CancellationToken cancellationToken = null);Parameters ​
| Name | Type | Description |
|---|---|---|
stream | Stream | |
cancellationToken | CancellationToken | A cancellation token. |
Returns ​
The byte read from the stream.