Skip to content

ArrayExtensions Class ​

Definition ​

Extensions for Array object types

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Methods ​

NameDescription
byte[] AppendBytes(byte[] input, byte[] bytesToAdd)Appends bytes to the end of an Array
string ArrayToString(IEnumerable<int> input, bool usePaddingAndIncrement = null)Converts input array of int's to a string with optional Padding and Increment
string ByteToString(byte[] input, Encoding encoding = null, int count = null)Convert byte array to string based on the appropriate encoding
string ByteToString(byte[] input, bool removeEncoding, Encoding encoding = null, int count = null)Convert byte array to string based on the appropriate encoding
bool Compare(T[] input, T[] compareTo)Compares two arrays for Equality using the type default EqualityComparer
void Empty(T[] input)Empties/Clears the content of the array
bool EndsWith(ReadOnlySpan<byte> source, ReadOnlySpan<byte> suffix)Checks if the source span ends with the specified suffix span.
bool EndsWith(byte[] input, ImmutableArray<byte> suffix)Checks if the source byte array ends with the specified suffix (ImmutableArray).
bool EndsWith(byte[] input, byte[] suffix)Checks if the source byte array ends with the specified suffix (byte array).
Encoding GetBomEncoding(byte[] input)Returns the Encoding indicated by a leading byte-order mark (BOM), if present; otherwise returns .
bool HasBomEncoding(byte[] input)Returns if the byte array begins with a recognized byte-order mark (BOM).
bool HasBomEncoding(byte[] input, out Encoding encoding)Returns if the byte array begins with a recognized byte-order mark (BOM).
string HashToString(byte[] input, bool keepUpper = null)Converts a byte array into a hashed string
void Left(T[] input, int count)Rotate an array of values the given number of positions to the Left in place
Dictionary<string, string> ParseCommandLineArgs(IEnumerable<string> input, bool removeLeadingHyphen = null)Returns Dictionary of command line arguements and values
byte[] PrependBytes(byte[] input, byte[] bytesToAdd)Add bytes to the leading edge of a byte array
byte[] RemoveEncodingBytes(byte[] input)Returns byte[] with an encoding bytes removed from the header
void Right(T[] input, int count)Rotate an array of values the given number of positions to the Right in place
T[] RotateLeft(T[] input, int count)Rotate an array of values the given number of positions to the Left and return the result
T[] RotateRight(T[] input, int count)Rotate an array of values the given number of positions to the Right and return the result
T[] Slice(T[] input, int start, int end)Get the array slice between the two indexes. ... Inclusive for start index, exclusive for end index.
bool StartsWith(ReadOnlySpan<byte> source, ReadOnlySpan<byte> prefix)Checks if byte array starts with a specified set of bytes
bool StartsWith(byte[] input, ImmutableArray<byte> prefix)Checks if byte array starts with a specified set of bytes
bool StartsWith(byte[] input, byte[] prefix)Checks if byte array starts with a specified set of bytes
string ToHexString(byte[] input)Returns Hex string representation of a byte[]
string ToInitializer(IEnumerable<int> input, bool usePaddingAndIncrement = null)Returns a string representing a means to initialize an as an Enumerable in code, optional padding obscures original values
int ToInt(byte[] input, Endianness endianness = null)Converts byte[] to an Integer of specified Endianness
string ToUnicodeString(byte[] input)Returns Unicode string representation of the byte[]