Esempio n. 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 (AccountId != null)
         {
             hashCode = hashCode * 59 + AccountId.GetHashCode();
         }
         if (BalanceUType != null)
         {
             hashCode = hashCode * 59 + BalanceUType.GetHashCode();
         }
         if (Deposit != null)
         {
             hashCode = hashCode * 59 + Deposit.GetHashCode();
         }
         if (Lending != null)
         {
             hashCode = hashCode * 59 + Lending.GetHashCode();
         }
         if (Purses != null)
         {
             hashCode = hashCode * 59 + Purses.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Returns true if BankingBalance instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingBalance to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingBalance other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                     ) &&
                 (
                     BalanceUType == other.BalanceUType ||
                     BalanceUType != null &&
                     BalanceUType.Equals(other.BalanceUType)
                 ) &&
                 (
                     Deposit == other.Deposit ||
                     Deposit != null &&
                     Deposit.Equals(other.Deposit)
                 ) &&
                 (
                     Lending == other.Lending ||
                     Lending != null &&
                     Lending.Equals(other.Lending)
                 ) &&
                 (
                     Purses == other.Purses ||
                     Purses != null &&
                     Purses.SequenceEqual(other.Purses)
                 ));
        }