예제 #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 (Identification != null)
         {
             hashCode = hashCode * 59 + Identification.GetHashCode();
         }
         if (PostalAddresses != null)
         {
             hashCode = hashCode * 59 + PostalAddresses.GetHashCode();
         }
         if (Availability != null)
         {
             hashCode = hashCode * 59 + Availability.GetHashCode();
         }
         if (Phones != null)
         {
             hashCode = hashCode * 59 + Phones.GetHashCode();
         }
         if (Services != null)
         {
             hashCode = hashCode * 59 + Services.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #2
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = string.IsNullOrWhiteSpace(Avatar) ? 0 : Avatar !.GetHashCode();
                hashCode = (hashCode * 397) ^ (string.IsNullOrWhiteSpace(Preview) ? 0 : Preview !.GetHashCode());
                hashCode = (hashCode * 397) ^ (string.IsNullOrWhiteSpace(GroupName) ? 0 : GroupName !.GetHashCode());

                hashCode = (hashCode * 397) ^ (Phones != null ? Phones.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ChatIds != null ? ChatIds.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (MessageText != null ? MessageText.GetHashCode() : 0);

                return(hashCode);
            }
        }