// Animancer // Copyright 2020 Kybernetik // using System.Collections.Generic; namespace Animancer { /// /// An which ignores overloaded equality operators so it is faster than /// for types derived from . /// public sealed class FastComparer : IEqualityComparer { /************************************************************************************************************************/ /// Singleton instance. public static readonly FastComparer Instance = new FastComparer(); /// Calls . /// /// We could use for slightly better performance, but that would not work /// for boxed value types (enums in particular). /// bool IEqualityComparer.Equals(object x, object y) { return Equals(x, y); } /// Calls . int IEqualityComparer.GetHashCode(object obj) { return obj.GetHashCode(); } /************************************************************************************************************************/ } }