From 5326b08c9927072da1a734ce16cb2ed5baf4707d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 8 Jan 2025 15:28:47 -0500 Subject: [PATCH] Move generic equality down a level --- SabreTools.DatItems/DatItem.cs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/SabreTools.DatItems/DatItem.cs b/SabreTools.DatItems/DatItem.cs index a0da9eb9..ab7c5176 100644 --- a/SabreTools.DatItems/DatItem.cs +++ b/SabreTools.DatItems/DatItem.cs @@ -189,6 +189,21 @@ namespace SabreTools.DatItems return _internal.Equals(otherItem); } + /// + public override bool Equals(ModelBackedItem? other) + { + // If other is null + if (other == null) + return false; + + // If the type is mismatched + if (other is not DatItem otherItem) + return false; + + // Compare internal models + return _internal.Equals(otherItem); + } + /// /// Determine if an item is a duplicate using partial matching logic /// @@ -597,21 +612,6 @@ namespace SabreTools.DatItems return string.Compare(selfName, otherName, StringComparison.Ordinal); } - /// - public override bool Equals(ModelBackedItem? other) - { - // If other is null - if (other == null) - return false; - - // If the type is mismatched - if (other is not DatItem otherItem) - return false; - - // Compare internal models - return _internal.Equals(otherItem); - } - /// /// Determine if an item is a duplicate using partial matching logic ///