Fonction Equals dans la classe Game

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 751fc9a079
commit de2c151e14

@ -98,9 +98,10 @@ namespace Model
return Name.GetHashCode(); return Name.GetHashCode();
} }
public bool Equals(Game other) public override bool Equals(object? obj)
{ {
return this.Name.Equals(other.Name) && this.Year.Equals(other.Year); if ((obj == null) || !this.GetType().Equals(obj.GetType())) return false;
return this.Name.Equals((obj as Game).Name) && this.Year.Equals((obj as Game).Year);
} }
public override string ToString() public override string ToString()

Loading…
Cancel
Save