Skip to content

StreamExtensions.ReadInt16OrThrowAsync Method ​

Definition ​

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

c#
public static ValueTask<Int16> ReadInt16OrThrowAsync(this Stream stream, Endian endian = Endian.MrKWatkins.BinaryPrimitives.Endian, CancellationToken cancellationToken = null);

Parameters ​

NameTypeDescription
streamStream
endianEndianThe endianness to use.
cancellationTokenCancellationTokenA cancellation token.

Returns ​

ValueTask<Int16>

The Int16 value read from the stream.