using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace StardewModdingAPI.Framework.StateTracking.Comparers
{
/// Compares values using their method. This should only be used when won't work, since this doesn't validate whether they're comparable.
/// The value type.
internal class GenericEqualsComparer : 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)
{
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);
}
}
}