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

Search Results for

    Edit this page

    Class CollectionExtensions

    Namespace
    AetherUtils.Core.Extensions
    Assembly
    AetherUtils.Core.dll
    Provides extension methods for manipulating IDictionary<TKey, TValue> and ICollection<T> objects.
    public static class CollectionExtensions
    Inheritance
    object
    CollectionExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()

    Methods

    AreListsEqual<T>(IList<T>, IList<T>)

    Checks if the two lists contain the same items.
    [UsedImplicitly]
    public static bool AreListsEqual<T>(this IList<T> list1, IList<T> list2) where T : notnull

    Parameters

    list1 IList<T>
    The source list.
    list2 IList<T>
    The list to compare list 1 against.

    Returns

    bool
    true if the two lists are equal; false otherwise.

    Type Parameters

    T
    The type of items in the lists.

    RenameKey<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TKey)

    Rename a key contained in a dictionary. This method is thread-safe.
    public static void RenameKey<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey oldKey, TKey newKey) where TKey : notnull

    Parameters

    dictionary IDictionary<TKey, TValue>
    The dictionary to perform the rename on.
    oldKey TKey
    The name of the old key.
    newKey TKey
    The name to change oldKey to.

    Type Parameters

    TKey
    The Type of the key.
    TValue
    The Type of the value.

    Remarks

    If the newKey is the same as the oldKey using the default equality operator, no operation is performed.

    Exceptions

    ArgumentNullException
    If dictionary is null.
    ArgumentException
    If newKey already exists in dictionary.
    (c) 2024 Ethan Hann. All rights reserved.