WriteAllAsync Method
Definition
- Namespace
- Cuemon.Extensions.IO
- Assemblies
- Cuemon.Extensions.IO.dll
WriteAllAsync(Stream, byte[], CancellationToken)
Asynchronously writes a sequence of bytes to the current stream with the entire size of the buffer starting from position 0.
public static Task WriteAllAsync(this Stream stream, byte[] buffer, CancellationToken ct = default)
Parameters
streamStreamThe Stream to extend.
bufferbyte[]The buffer to write data from.
ctCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous write operation.
Exceptions
- ArgumentNullException
streamis null -or-bufferis null.- NotSupportedException
The stream does not support writing.
- ObjectDisposedException
The stream has been disposed.
- InvalidOperationException
The stream is currently in use by a previous write operation.