Class ByteArrayExtensions
- Namespace
- Cuemon.Extensions.Net
- Assembly
- Cuemon.Extensions.Net.dll
Extension methods for the byte[].
public static class ByteArrayExtensions
- Inheritance
-
ByteArrayExtensions
Methods
UrlEncode(Byte[], Int32, Int32, Action<EncodingOptions>)
Converts the specified bytes
into a URL-encoded array of bytes, starting at the specified position
in the array and continuing for the specified number of bytesToRead
.
public static byte[] UrlEncode(this byte[] bytes, int position = 0, int bytesToRead = -1, Action<EncodingOptions> setup = null)
Parameters
bytes
Byte[]The byte[] to extend.
position
Int32The position in the byte array at which to begin encoding.
bytesToRead
Int32The number of bytes to encode.
setup
Action<EncodingOptions>The EncodingOptions which may be configured.
Returns
- Byte[]
An encoded byte[].
Exceptions
- ArgumentNullException
bytes
cannot be null.- ArgumentOutOfRangeException
position
is lower than 0 - or -bytesToRead
is lower than 0 - or -position
is greater than or equal to the length ofbytes
- or -bytesToRead
is greater than (the length ofbytes
minusposition
).