TriLib
Search Results for

    Show / Hide Table of Contents

    Class ArrayUtils

    Provides utility methods for manipulating arrays and byte-based streams.

    Inheritance
    object
    ArrayUtils
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: TriLibCore.Utils
    Assembly: TriLibCore.dll
    Syntax
    public static class ArrayUtils

    Methods

    Add<T>(ref T[], T)

    Adds an item to the end of the specified array, resizing the array to accommodate the new element.

    Declaration
    public static void Add<T>(ref T[] arr, T item)
    Parameters
    Type Name Description
    T[] arr

    A reference to the array to which the item will be added.

    T item

    The item to add to the array.

    Type Parameters
    Name Description
    T

    The type of elements contained within the array.

    ContainsType<T>(Array)

    Determines whether the specified array contains at least one element of a given type.

    Declaration
    public static bool ContainsType<T>(Array array)
    Parameters
    Type Name Description
    Array array

    The array to search.

    Returns
    Type Description
    bool

    true if the array contains at least one element of the specified type; otherwise, false.

    Type Parameters
    Name Description
    T

    The type to look for within the array.

    Remove<T>(ref T[], T)

    Removes the first occurrence of a specified item from the specified array, resizing the array if the item is found.

    Declaration
    public static void Remove<T>(ref T[] arr, T item)
    Parameters
    Type Name Description
    T[] arr

    A reference to the array from which the item will be removed.

    T item

    The item to remove from the array.

    Type Parameters
    Name Description
    T

    The type of elements contained within the array.

    ToMemoryStream(IList<byte>, ref MemoryStream)

    Copies the contents of the specified list of bytes into the specified MemoryStream.

    Declaration
    public static void ToMemoryStream(this IList<byte> list, ref MemoryStream memoryStream)
    Parameters
    Type Name Description
    IList<byte> list

    The source list of bytes to copy from.

    MemoryStream memoryStream

    A reference to the MemoryStream where the bytes will be copied. If the underlying buffer of memoryStream is empty, a new buffer of the appropriate size is created.

    In this article
    Back to top Generated by DocFX