feat: added IEquatable interfaces to primitives
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Engine.Core;
|
||||
@@ -11,7 +12,7 @@ namespace Engine.Core;
|
||||
/// Initializes a new instance of the <see cref="Line2D"/> struct with the specified endpoints.
|
||||
/// </remarks>
|
||||
[System.Diagnostics.DebuggerDisplay("From: {From.ToString(),nq}, To: {To.ToString(),nq}, Direction: {Direction.ToString(),nq}, Length: {Length}")]
|
||||
public readonly struct Line2D(Vector2D from, Vector2D to)
|
||||
public readonly struct Line2D(Vector2D from, Vector2D to) : IEquatable<Line2D>
|
||||
{
|
||||
/// <summary>
|
||||
/// The starting point of the <see cref="Line2D"/> segment.
|
||||
@@ -196,6 +197,7 @@ public readonly struct Line2D(Vector2D from, Vector2D to)
|
||||
/// <param name="obj">The object to compare with the current <see cref="Line2D"/>.</param>
|
||||
/// <returns><see cref="true"/> if the specified object is equal to the current <see cref="Line2D"/>; otherwise, <see cref="false"/>.</returns>
|
||||
public override bool Equals(object? obj) => obj is Line2D line2D && this == line2D;
|
||||
public bool Equals(Line2D other) => this == other;
|
||||
|
||||
/// <summary>
|
||||
/// Generates a hash code for the <see cref="Line2D"/>.
|
||||
|
Reference in New Issue
Block a user