#nullable disable using System; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace StardewModdingAPI.Framework.StateTracking.Comparers { /// Compares instances using . /// The value type. internal class EquatableComparer : IEqualityComparer where T : IEquatable { /********* ** Public methods *********/ /// Determines whether the specified objects are equal. /// true if the specified objects are equal; otherwise, false. /// The first object to compare. /// The second object to compare. public bool Equals(T x, T y) { if (x == null) return y == null; return x.Equals(y); } /// Get a hash code for the specified object. /// The value. public int GetHashCode(T obj) { return RuntimeHelpers.GetHashCode(obj); } } }