Skip to content

Commit

Permalink
Add Equals for comparing two IComponent objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
isadorasophia committed Jul 21, 2024
1 parent 3ce429a commit 3366c95
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Bang/Components/IComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,19 @@
/// </summary>
public interface IComponent
{
public static bool Equals(IComponent? a, IComponent? b)
{
if (a is null || b is null)
{
return a is null && b is null;
}

if (a is IEquatable<IComponent> iA)
{
return iA.Equals(b);
}

return a.Equals(b);
}
}
}

0 comments on commit 3366c95

Please sign in to comment.