Beispiel #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 (Balance != null)
         {
             hashCode = hashCode * 59 + Balance.GetHashCode();
         }
         if (UnrealizedPl != null)
         {
             hashCode = hashCode * 59 + UnrealizedPl.GetHashCode();
         }
         if (Equity != null)
         {
             hashCode = hashCode * 59 + Equity.GetHashCode();
         }
         if (AmData != null)
         {
             hashCode = hashCode * 59 + AmData.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns true if AccountStateResponse instances are equal
        /// </summary>
        /// <param name="other">Instance of AccountStateResponse to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountStateResponse other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Balance == other.Balance ||
                     Balance != null &&
                     Balance.Equals(other.Balance)
                     ) &&
                 (
                     UnrealizedPl == other.UnrealizedPl ||
                     UnrealizedPl != null &&
                     UnrealizedPl.Equals(other.UnrealizedPl)
                 ) &&
                 (
                     Equity == other.Equity ||
                     Equity != null &&
                     Equity.Equals(other.Equity)
                 ) &&
                 (
                     AmData == other.AmData ||
                     AmData != null &&
                     AmData.SequenceEqual(other.AmData)
                 ));
        }