Compare by reference in ControlPoint.Equals()

This commit is contained in:
Dan Balasescu 2022-06-21 12:05:28 +09:00
parent e0c82d11ab
commit 6a26461683
1 changed files with 6 additions and 2 deletions

View File

@ -52,8 +52,12 @@ public sealed override bool Equals(object? obj)
&& Equals(otherControlPoint);
public virtual bool Equals(ControlPoint? other)
=> other != null
&& Time == other.Time;
{
if (ReferenceEquals(other, null)) return false;
if (ReferenceEquals(other, this)) return true;
return Time == other.Time;
}
// ReSharper disable once NonReadonlyMemberInGetHashCode
public override int GetHashCode() => Time.GetHashCode();