Skip to content

StreamExtensions.ReadInt32OrThrowAsync Method ​

Definition ​

Reads an Int32 from the stream asynchronously, throwing EndOfStreamException if the end of the stream has been reached.

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

Parameters ​

NameTypeDescription
streamStream
endianEndianThe endianness to use.
cancellationTokenCancellationTokenA cancellation token.

Returns ​

ValueTask<Int32>

The Int32 value read from the stream.