Skip to content

Commit

Permalink
refactor: check type as well
Browse files Browse the repository at this point in the history
  • Loading branch information
meaboutsoftware committed Jun 18, 2024
1 parent e0283e9 commit ad25701
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ public abstract class ValueObject : IEquatable<ValueObject>
{
protected abstract IEnumerable<object> GetEqualityComponents();

public bool Equals(ValueObject? other) => other is not null && IsSequenceEqual(other);
public bool Equals(ValueObject? other) =>
other is not null && GetType() == other.GetType() && IsSequenceEqual(other);

public override bool Equals(object? obj)
{
Expand Down

0 comments on commit ad25701

Please sign in to comment.