forType<T> 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, or BigInt) or will be a comparer that has been registered via a call to EqualityComparer.addDefaultEqualityComparer.

If no registered comparer can be found, this method will return a new instance of EqualityComparer as if EqualityComparer<T>() was called instead.

Implementation

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