Skip to content

StreamExtensions.ReadAllBytesAsync Method ​

Definition ​

Reads all remaining bytes from the stream asynchronously.

c#
public static ValueTask<Byte[]> ReadAllBytesAsync(this Stream stream, CancellationToken cancellationToken = null);

Parameters ​

NameTypeDescription
streamStream
cancellationTokenCancellationTokenA cancellation token.

Returns ​

ValueTask<Byte[]>

A byte array containing all remaining bytes from the stream.