Class ByteArrayExtensions
- Namespace
- Cuemon.Extensions.IO
- Assembly
- Cuemon.Extensions.IO.dll
Extension methods for the byte[].
public static class ByteArrayExtensions
- Inheritance
-
ByteArrayExtensions
Methods
ToStream(byte[])
Converts the specified bytes to its equivalent Stream representation.
public static Stream ToStream(this byte[] bytes)
Parameters
bytesbyte[]The byte[] to extend.
Returns
Exceptions
- ArgumentNullException
bytescannot be null.
ToStreamAsync(byte[], CancellationToken)
Converts the specified bytes to its equivalent Stream representation.
public static Task<Stream> ToStreamAsync(this byte[] bytes, CancellationToken cancellationToken = default)
Parameters
bytesbyte[]The byte[] to extend.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests. The default value is None.
Returns
- Task<Stream>
A task that represents the asynchronous operation. The task result contains a Stream that is equivalent to
bytes.
Exceptions
- ArgumentNullException
bytescannot be null.