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
bytes
Byte[]The byte[] to extend.
Returns
Exceptions
- ArgumentNullException
bytes
cannot 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(CancellationToken))
Parameters
bytes
Byte[]The byte[] to extend.
cancellationToken
CancellationTokenThe 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
bytes
cannot be null.