SingletonEqualityComparer Class

public abstract class SingletonEqualityComparer<T, U> : EqualityComparer<T> where U : class, new()

All Equality Comparers used by the kit are derived from this class. Equality Comparers do not store data, therefore to save on unecessary objects being created, you can utilize a singleton for all kit comparers, rather than initializing a new object whenever a comparer is needed.

If you wish to create a new equality comparer that can be used like a singleton, keep in mind that the generic type parameter T is the type that the comparer compares, while U is the Type of your comparer class implementation. Check out the other Comparers to see how the class definition is setup.

Properties

Name Type Description
Instance U

Returns the singleton instance of the equality comparer.