ObjectUtility.CreateEqualityComparer<T> method (1 of 2)

Creates an equality comparer from delegates.

public static EqualityComparer<T> CreateEqualityComparer<T>(Func<T?, T?, bool> equals)
parameter description
T The type to compare.
equals The equals delegate.

Return Value

The equality comparer.

Remarks

If GetHashCode is called, it will throw a NotImplementedException.

See Also


ObjectUtility.CreateEqualityComparer<T> method (2 of 2)

Creates an equality comparer from delegates.

public static EqualityComparer<T> CreateEqualityComparer<T>(Func<T?, T?, bool> equals, 
    Func<T, int> getHashCode)
parameter description
T The type to compare.
equals The equals delegate.
getHashCode The hash code delegate.

Return Value

The equality comparer.

Remarks

If getHashCode is null and GetHashCode is called, it will throw a NotImplementedException.

See Also