From e401d5e74480f60ccac13e22ba0264a11d40b7b9 Mon Sep 17 00:00:00 2001 From: Corentin LEMAIRE Date: Sat, 10 Jun 2023 23:35:58 +0200 Subject: [PATCH] Fix minor code smells --- Sources/Model/CustomTitle.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Sources/Model/CustomTitle.cs b/Sources/Model/CustomTitle.cs index 0b11cf7..148ff81 100644 --- a/Sources/Model/CustomTitle.cs +++ b/Sources/Model/CustomTitle.cs @@ -88,22 +88,14 @@ namespace Model /// /// Fonction qui permet de déterminer si deux objets CustomTitle sont égaux selon leurs chemin d'accès /// - /// - /// Un booléen indiquant si les chemins d'accès sont égaux - public bool Equals(CustomTitle other) - => Path.Equals(other?.Path); - - /// - /// Fonction qui permet de déterminer si deux objets CustomTitle sont égaux - /// /// /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { - if (ReferenceEquals(obj, null)) return false; - if (ReferenceEquals(this, obj)) return true; - if (GetType() != obj.GetType()) return false; - return Equals(obj as CustomTitle); + if (obj is null) return false; + if (obj.GetType() != typeof(CustomTitle)) return false; + if (obj is CustomTitle custom && Path == custom.Path) return true; + else return false; } ///