Aether Utilities Aether Utilities
Aether Utilities Aether Utilities
DocFX + Singulink = ♥

Search Results for

    Edit this page

    Class ArrayExtensions

    Namespace
    AetherUtils.Core.Extensions
    Assembly
    AetherUtils.Core.dll
    Provides extension methods for manipulating Array objects.
    public static class ArrayExtensions
    Inheritance
    object
    ArrayExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()

    Methods

    FromPrintableString(string)

    Convert a hexadecimal string representation of bytes into its equivalent byte array.
    public static IEnumerable<byte> FromPrintableString(this string byteString)

    Parameters

    byteString string
    The string containing the hexadecimal values. This string can contain values seperated by '-' (CE-B7-8D) or not (CEB78D).

    Returns

    IEnumerable<byte>
    A byte array representing the hexadecimal string.

    ToImage(byte[])

    Get an Image represented by the byte array.
    [UsedImplicitly]
    public static Image ToImage(this byte[] bytes)

    Parameters

    bytes byte[]
    The byte array containing properly formatted image bytes.

    Returns

    Image
    A new Image.

    Exceptions

    ArgumentNullException
    If bytes was null.
    FormatException
    If bytes did not have a valid ImageFormat.

    ToPrintableString(IEnumerable<byte>)

    Convert the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string representation.
    public static string ToPrintableString(this IEnumerable<byte> bytes)

    Parameters

    bytes IEnumerable<byte>
    An IEnumerable<T> of bytes.

    Returns

    string
    A string of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A-00".

    Exceptions

    ArgumentNullException
    If bytes was null.

    ToStringList<T>(T[], char, string, string)

    Convert an array of values to a string using the specified prefix, delimiter, and optional suffix.
    [UsedImplicitly]
    public static string ToStringList<T>(this T[] values, char delimiter = ',', string prefix = "", string suffix = "")

    Parameters

    values T[]
    The array of values to combine.
    delimiter char
    The delimiter to separate the values with; default is ','
    prefix string
    The prefix to add to the resulting string; default is an empty string.
    suffix string
    The suffix to add to the resulting string; default is an empty string.

    Returns

    string
    A string formatted with the values seperated by the delimiter.

    Type Parameters

    T
    The type of objects contained within the array.

    Examples

    string[] values = ["val1", "val2", "val3"];
    string str = values.ToStringList(',', "PRE(", ")");
    returns: "PRE(val1,val2,val3)"

    Exceptions

    ArgumentNullException
    If values, prefix was null.
    (c) 2024 Ethan Hann. All rights reserved.