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

            return
                ((
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                     ) &&
                 (
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     MaskedNumber == other.MaskedNumber ||
                     MaskedNumber != null &&
                     MaskedNumber.Equals(other.MaskedNumber)
                 ) &&
                 (
                     OpenStatus == other.OpenStatus ||
                     OpenStatus != null &&
                     OpenStatus.Equals(other.OpenStatus)
                 ) &&
                 (
                     IsOwned == other.IsOwned ||
                     IsOwned != null &&
                     IsOwned.Equals(other.IsOwned)
                 ) &&
                 (
                     ProductCategory == other.ProductCategory ||
                     ProductCategory != null &&
                     ProductCategory.Equals(other.ProductCategory)
                 ) &&
                 (
                     ProductName == other.ProductName ||
                     ProductName != null &&
                     ProductName.Equals(other.ProductName)
                 ));
        }
예제 #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 (AccountId != null)
         {
             hashCode = hashCode * 59 + AccountId.GetHashCode();
         }
         if (DisplayName != null)
         {
             hashCode = hashCode * 59 + DisplayName.GetHashCode();
         }
         if (Nickname != null)
         {
             hashCode = hashCode * 59 + Nickname.GetHashCode();
         }
         if (MaskedNumber != null)
         {
             hashCode = hashCode * 59 + MaskedNumber.GetHashCode();
         }
         if (OpenStatus != null)
         {
             hashCode = hashCode * 59 + OpenStatus.GetHashCode();
         }
         if (IsOwned != null)
         {
             hashCode = hashCode * 59 + IsOwned.GetHashCode();
         }
         if (ProductCategory != null)
         {
             hashCode = hashCode * 59 + ProductCategory.GetHashCode();
         }
         if (ProductName != null)
         {
             hashCode = hashCode * 59 + ProductName.GetHashCode();
         }
         return(hashCode);
     }
 }