Use exact component value equality checks in equality comparisons

(cherry picked from commit 2cddf3de97943844512b2d84aa6be122c6f0d409)
This commit is contained in:
2025-04-18 18:43:42 +03:00
parent af955ba418
commit 8986290b12
34 changed files with 164 additions and 190 deletions

View File

@@ -499,21 +499,19 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(ref Rectangle other)
{
return Location.Equals(ref other.Location) && Size.Equals(ref other.Size);
return Location == other.Location && Size == other.Size;
}
/// <inheritdoc />
public bool Equals(Rectangle other)
{
return Location.Equals(ref other.Location) && Size.Equals(ref other.Size);
return Equals(ref other);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
return false;
return obj is Rectangle && Equals((Rectangle)obj);
return obj is Rectangle other && Equals(ref other);
}
/// <inheritdoc />