From de2c151e14c329815a70e9740e97db71f100bc8e Mon Sep 17 00:00:00 2001 From: Anthony RICHARD Date: Mon, 22 May 2023 17:40:30 +0100 Subject: [PATCH] Fonction Equals dans la classe Game --- Sources/Stim.Model/Game.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Stim.Model/Game.cs b/Sources/Stim.Model/Game.cs index 532633d..8c805b9 100644 --- a/Sources/Stim.Model/Game.cs +++ b/Sources/Stim.Model/Game.cs @@ -98,9 +98,10 @@ namespace Model 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()