Search Results for

    Show / Hide Table of Contents

    Class Utils

    Extension methods and more...

    Inheritance
    object
    Utils
    Namespace: Evergine.Common.Helpers
    Assembly: Evergine.Common.dll
    Syntax
    public static class Utils

    Methods

    CompareTo<T>(T[], T[])

    Compares an array with another array.

    Declaration
    public static bool CompareTo<T>(this T[] array1, T[] array2) where T : IEquatable<T>
    Parameters
    Type Name Description
    T[] array1

    Specifies the first array.

    T[] array2

    Specifies the second array.

    Returns
    Type Description
    bool

    True if the first array and the second array are equal; otherwise, false.

    Type Parameters
    Name Description
    T

    The array type.

    DisposeAndNull<T>(ref T)

    Safely disposes of a reference if it is not null and sets it to null after disposal.

    Declaration
    public static void DisposeAndNull<T>(ref T disposable) where T : class, IDisposable
    Parameters
    Type Name Description
    T disposable

    The object to dispose of.

    Type Parameters
    Name Description
    T

    The type of object to dispose of.

    Remarks

    The reference will be set to null after disposal.

    RemoveDuplicatesFromSortedList<T>(List<T>, Comparison<T>)

    Removes duplicate elements from a sorted list.

    Declaration
    public static void RemoveDuplicatesFromSortedList<T>(this List<T> list, Comparison<T> comparison = null) where T : IComparable<T>
    Parameters
    Type Name Description
    List<T> list

    The list to process.

    Comparison<T> comparison

    The comparison method to use for sorting.

    Type Parameters
    Name Description
    T

    The type of the elements in the list.

    SortAndRemoveDuplicates<T>(List<T>, Comparison<T>)

    Sorts a list and removes the duplicates.

    Declaration
    public static void SortAndRemoveDuplicates<T>(this List<T> list, Comparison<T> comparison = null) where T : IComparable<T>
    Parameters
    Type Name Description
    List<T> list

    The list to process.

    Comparison<T> comparison

    The comparison method to use for sorting.

    Type Parameters
    Name Description
    T

    The type of the elements in the list.

    In this article
    Back to top
    Generated by DocFX