Class DelegateEqualityComparer<T>
A custom equality comparer that excepts a delegate to do the comparison operation
Inheritance
System.Object
Namespace: Umbraco.Core
Assembly: Umbraco.Core.dll
Syntax
public class DelegateEqualityComparer<T> : IEqualityComparer<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
View SourceDelegateEqualityComparer(Func<T, T, Boolean>, Func<T, Int32>)
Declaration
public DelegateEqualityComparer(Func<T, T, bool> equals, Func<T, int> getHashcode)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, T, System.Boolean> | equals | |
System.Func<T, System.Int32> | getHashcode |
Methods
View SourceCompareMember<TMember>(Func<T, TMember>)
Declaration
public static DelegateEqualityComparer<T> CompareMember<TMember>(Func<T, TMember> memberExpression)
where TMember : IEquatable<TMember>
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TMember> | memberExpression |
Returns
Type | Description |
---|---|
DelegateEqualityComparer<T> |
Type Parameters
Name | Description |
---|---|
TMember |
Equals(T, T)
Determines whether the specified objects are equal.
Declaration
public bool Equals(T x, T y)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object of type |
T | y | The second object of type |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified objects are equal; otherwise, false. |
GetHashCode(T)
Returns a hash code for the specified object.
Declaration
public int GetHashCode(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | 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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The type of |