Class IEqualityComparerEx
Class containing some extension methods for System.Collections.Generic.IEqualityComparer<T>.
Inheritance
System.Object
IEqualityComparerEx
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class IEqualityComparerEx
Methods
| Improve this Doc View SourceBy<TSource, TKey>(Func<TSource, TKey>, IEqualityComparer<TKey>)
Creates an equality comparer based on the specified comparison key and key comparer.
Declaration
public static IEqualityComparer<TSource> By<TSource, TKey>(Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><TSource, TKey> | keySelector | A function that returns the comparison key. |
System.Collections.Generic.IEqualityComparer<T><TKey> | comparer | An optional comparer, used to compare the keys. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEqualityComparer<T><TSource> | Returns an equality comparer based on the specified comparison key and key comparer. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the objects to test for equality. |
TKey | The type of the key to compare. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | keySelector can not be null. |