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
-
CollectionExtensions
- Inherited Members
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
Returns
- bool
trueif the two lists are equal;falseotherwise.
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
dictionaryIDictionary<TKey, TValue>- The dictionary to perform the rename on.
oldKeyTKey- The name of the old key.
newKeyTKey- The name to change
oldKeyto.
Type Parameters
Remarks
If the
newKey is the same as the oldKey using the default equality
operator,
no operation is performed.Exceptions
- ArgumentNullException
- If
dictionaryisnull. - ArgumentException
- If
newKeyalready exists indictionary.