diff --git a/ICD.Common.Utils/Services/Logging/LogItem.cs b/ICD.Common.Utils/Services/Logging/LogItem.cs index 61ab71d..9e55de4 100644 --- a/ICD.Common.Utils/Services/Logging/LogItem.cs +++ b/ICD.Common.Utils/Services/Logging/LogItem.cs @@ -7,7 +7,7 @@ namespace ICD.Common.Utils.Services.Logging /// /// Log Entry Item /// - public struct LogItem + public struct LogItem : IEquatable { private readonly string m_Message; private readonly eSeverity m_Severity; @@ -93,7 +93,14 @@ namespace ICD.Common.Utils.Services.Logging /// public static bool operator !=(LogItem a1, LogItem a2) { - return !(a1 == a2); + return !a1.Equals(a2); + } + + public bool Equals(LogItem other) + { + return m_Severity == other.m_Severity && + m_Timestamp == other.m_Timestamp && + m_Message == other.m_Message; } /// @@ -103,10 +110,7 @@ namespace ICD.Common.Utils.Services.Logging /// public override bool Equals(object other) { - if (other == null || GetType() != other.GetType()) - return false; - - return GetHashCode() == ((LogItem)other).GetHashCode(); + return other is LogItem && Equals((LogItem)other); } /// diff --git a/ICD.Common.Utils/Xml/IcdXmlAttribute.cs b/ICD.Common.Utils/Xml/IcdXmlAttribute.cs index 3f4e91c..bf57430 100644 --- a/ICD.Common.Utils/Xml/IcdXmlAttribute.cs +++ b/ICD.Common.Utils/Xml/IcdXmlAttribute.cs @@ -1,9 +1,11 @@ -namespace ICD.Common.Utils.Xml +using System; + +namespace ICD.Common.Utils.Xml { /// /// IcdXmlAttribute represents an attribute="value" pair from xml. /// - public struct IcdXmlAttribute + public struct IcdXmlAttribute : IEquatable { private readonly string m_Name; private readonly string m_Value; @@ -41,7 +43,13 @@ /// public static bool operator !=(IcdXmlAttribute a1, IcdXmlAttribute a2) { - return !(a1 == a2); + return !a1.Equals(a2); + } + + public bool Equals(IcdXmlAttribute other) + { + return m_Name == other.m_Name && + m_Value == other.m_Value; } /// @@ -51,10 +59,7 @@ /// public override bool Equals(object other) { - if (other == null || GetType() != other.GetType()) - return false; - - return GetHashCode() == ((IcdXmlAttribute)other).GetHashCode(); + return other is IcdXmlAttribute && Equals((IcdXmlAttribute)other); } ///