Class KeyEqualityComparer<TSource, TKey>
Key based equality comparer.
Inheritance
System.Object
KeyEqualityComparer<TSource, TKey>
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 class KeyEqualityComparer<TSource, TKey> : IEqualityComparer<TSource>
Type Parameters
Name | Description |
---|---|
TSource | The type of the objects to test for equality. |
TKey | The type of the key to compare. |
Constructors
| Improve this Doc View SourceKeyEqualityComparer(Func<TSource, TKey>, IEqualityComparer<TKey>)
Creates a new instance of the KeyEqualityComparer<TSource, TKey> class.
Declaration
public KeyEqualityComparer(Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><TSource, TKey> | keySelector | The key selector. |
System.Collections.Generic.IEqualityComparer<T><TKey> | comparer | An optional comparer, used to compare the keys. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | keySelector can not be null. |
Methods
| Improve this Doc View SourceEquals(TSource, TSource)
Determines whether the specified objects are equal.
Declaration
public bool Equals(TSource x, TSource y)
Parameters
Type | Name | Description |
---|---|---|
TSource | x | The first object of type TSource to compare. |
TSource | y | The second object of type TSource to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified objects are equal; otherwise, false. |
Implements
System.Collections.Generic.IEqualityComparer<T>.Equals(T, T)
|
Improve this Doc
View Source
GetHashCode(TSource)
Returns a hash code for the specified object.
Declaration
public int GetHashCode(TSource obj)
Parameters
Type | Name | Description |
---|---|---|
TSource | obj | The System.Object for which a hash code is to be returned. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the specified object. |
Implements
System.Collections.Generic.IEqualityComparer<T>.GetHashCode(T)
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The type of obj is a reference type and obj is null. |