コード例 #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 (BankAccountIban != null)
         {
             hashCode = hashCode * 59 + BankAccountIban.GetHashCode();
         }
         if (CompanyName != null)
         {
             hashCode = hashCode * 59 + CompanyName.GetHashCode();
         }
         if (ContactDetails != null)
         {
             hashCode = hashCode * 59 + ContactDetails.GetHashCode();
         }
         if (MandateAddress != null)
         {
             hashCode = hashCode * 59 + MandateAddress.GetHashCode();
         }
         if (PersonalInformation != null)
         {
             hashCode = hashCode * 59 + PersonalInformation.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns true if MandateCustomer instances are equal
        /// </summary>
        /// <param name="other">Instance of MandateCustomer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MandateCustomer other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BankAccountIban == other.BankAccountIban ||
                     BankAccountIban != null &&
                     BankAccountIban.Equals(other.BankAccountIban)
                     ) &&
                 (
                     CompanyName == other.CompanyName ||
                     CompanyName != null &&
                     CompanyName.Equals(other.CompanyName)
                 ) &&
                 (
                     ContactDetails == other.ContactDetails ||
                     ContactDetails != null &&
                     ContactDetails.Equals(other.ContactDetails)
                 ) &&
                 (
                     MandateAddress == other.MandateAddress ||
                     MandateAddress != null &&
                     MandateAddress.Equals(other.MandateAddress)
                 ) &&
                 (
                     PersonalInformation == other.PersonalInformation ||
                     PersonalInformation != null &&
                     PersonalInformation.Equals(other.PersonalInformation)
                 ));
        }