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

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     CountryCallingCode == other.CountryCallingCode ||
                     CountryCallingCode != null &&
                     CountryCallingCode.Equals(other.CountryCallingCode)
                 ) &&
                 (
                     AreaCode == other.AreaCode ||
                     AreaCode != null &&
                     AreaCode.Equals(other.AreaCode)
                 ) &&
                 (
                     Number == other.Number ||
                     Number != null &&
                     Number.Equals(other.Number)
                 ));
        }
Exemple #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 (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (CountryCallingCode != null)
         {
             hashCode = hashCode * 59 + CountryCallingCode.GetHashCode();
         }
         if (AreaCode != null)
         {
             hashCode = hashCode * 59 + AreaCode.GetHashCode();
         }
         if (Number != null)
         {
             hashCode = hashCode * 59 + Number.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if PhoneChannelPhone instances are equal
        /// </summary>
        /// <param name="other">Instance of PhoneChannelPhone to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PhoneChannelPhone other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CountryCallingCode == other.CountryCallingCode ||
                     CountryCallingCode != null &&
                     CountryCallingCode.Equals(other.CountryCallingCode)
                     ) &&
                 (
                     AreaCode == other.AreaCode ||
                     AreaCode != null &&
                     AreaCode.Equals(other.AreaCode)
                 ) &&
                 (
                     Number == other.Number ||
                     Number != null &&
                     Number.Equals(other.Number)
                 ) &&
                 (
                     AdditionalInfo == other.AdditionalInfo ||
                     AdditionalInfo != null &&
                     AdditionalInfo.Equals(other.AdditionalInfo)
                 ));
        }