From f66c59151b9042a2879668df47112d5e2a4b20f8 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 1 Apr 2020 15:35:00 -0500 Subject: [PATCH] AbsolutePath implements IEquatable Equals(object) simplification --- Wabbajack.Common/Paths.cs | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/Wabbajack.Common/Paths.cs b/Wabbajack.Common/Paths.cs index f77d8fef..36a380d7 100644 --- a/Wabbajack.Common/Paths.cs +++ b/Wabbajack.Common/Paths.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -24,33 +24,18 @@ namespace Wabbajack.Common public RelativePath FileName { get; } } - public struct AbsolutePath : IPath, IComparable + public struct AbsolutePath : IPath, IComparable, IEquatable { #region ObjectEquality - private bool Equals(AbsolutePath other) + public bool Equals(AbsolutePath other) { return _path == other._path; } public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - if (obj.GetType() != GetType()) - { - return false; - } - - return Equals((AbsolutePath)obj); + return obj is AbsolutePath other && Equals(other); } #endregion