forType<T> static method

EqualityComparer<T> forType<T>()

Returns the default EqualityComparer that has been registered for type T.

The returned EqualityComparer will be the type registered to T for use as the comparer when the comparer parameter in various LINQ methods is omitted. The EqualityComparer will be one of the built-in default comparers (for dynamic, num, int, double, String, Duration, DateTime, or BigInt) or will be a comparer that has been registered via a call to EqualityComparer.registerEqualityComparer.

If no registered comparer can be found, this method returns a default EqualityComparer;

Implementation

static EqualityComparer<T> forType<T>() =>
    (_registeredEqualityComparers[T] ?? EqualityComparer<T>())
        as EqualityComparer<T>;