using System.Collections.Generic; using System.Runtime.CompilerServices; namespace StardewModdingAPI.Framework.StateTracking.Comparers { /// A comparer which considers two references equal if they point to the same instance. /// The value type. internal class ObjectReferenceComparer : IEqualityComparer { /********* ** 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) { return object.ReferenceEquals(x, y); } /// Get a hash code for the specified object. /// The value. public int GetHashCode(T obj) { return RuntimeHelpers.GetHashCode(obj); } } }