Beispiel #1
0
        /// <summary>
        /// Returns true if HalLink instances are equal
        /// </summary>
        /// <param name="other">Instance of HalLink to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(HalLink other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Href == other.Href ||
                     Href != null &&
                     Href.Equals(other.Href)
                     ) &&
                 (
                     Templated == other.Templated ||

                     Templated.Equals(other.Templated)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Deprecation == other.Deprecation ||
                     Deprecation != null &&
                     Deprecation.Equals(other.Deprecation)
                 ) &&
                 (
                     Profile == other.Profile ||
                     Profile != null &&
                     Profile.Equals(other.Profile)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Hreflang == other.Hreflang ||
                     Hreflang != null &&
                     Hreflang.Equals(other.Hreflang)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ));
        }
Beispiel #2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Href != null)
                {
                    hashCode = hashCode * 59 + Href.GetHashCode();
                }

                hashCode = hashCode * 59 + Templated.GetHashCode();
                if (Type != null)
                {
                    hashCode = hashCode * 59 + Type.GetHashCode();
                }
                if (Deprecation != null)
                {
                    hashCode = hashCode * 59 + Deprecation.GetHashCode();
                }
                if (Profile != null)
                {
                    hashCode = hashCode * 59 + Profile.GetHashCode();
                }
                if (Title != null)
                {
                    hashCode = hashCode * 59 + Title.GetHashCode();
                }
                if (Hreflang != null)
                {
                    hashCode = hashCode * 59 + Hreflang.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }
                return(hashCode);
            }
        }