Пример #1
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 (Streetname != null)
         {
             hashCode = hashCode * 59 + Streetname.GetHashCode();
         }
         if (Zipcode != null)
         {
             hashCode = hashCode * 59 + Zipcode.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #2
0
        /// <summary>
        /// Returns true if Address instances are equal
        /// </summary>
        /// <param name="other">Instance of Address to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Address other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Streetname == other.Streetname ||
                     Streetname != null &&
                     Streetname.Equals(other.Streetname)
                     ) &&
                 (
                     Zipcode == other.Zipcode ||
                     Zipcode != null &&
                     Zipcode.Equals(other.Zipcode)
                 ));
        }