namespace ICD.Common.Utils.Xml { /// /// IcdXmlAttribute represents an attribute="value" pair from xml. /// public struct IcdXmlAttribute { private readonly string m_Name; private readonly string m_Value; public string Name { get { return m_Name; } } public string Value { get { return m_Value; } } /// /// Constructor. /// /// /// public IcdXmlAttribute(string name, string value) { m_Name = name; m_Value = value; } /// /// Implementing default equality. /// /// /// /// public static bool operator ==(IcdXmlAttribute a1, IcdXmlAttribute a2) { return a1.Equals(a2); } /// /// Implementing default inequality. /// /// /// /// public static bool operator !=(IcdXmlAttribute a1, IcdXmlAttribute a2) { return !(a1 == a2); } /// /// Returns true if this instance is equal to the given object. /// /// /// public override bool Equals(object other) { if (other == null || GetType() != other.GetType()) return false; return GetHashCode() == ((IcdXmlAttribute)other).GetHashCode(); } /// /// Gets the hashcode for this instance. /// /// public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (m_Name == null ? 0 : m_Name.GetHashCode()); hash = hash * 23 + (m_Value == null ? 0 : m_Value.GetHashCode()); return hash; } } } }