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

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     MinQty == other.MinQty ||
                     MinQty != null &&
                     MinQty.Equals(other.MinQty)
                 ) &&
                 (
                     MaxQty == other.MaxQty ||
                     MaxQty != null &&
                     MaxQty.Equals(other.MaxQty)
                 ) &&
                 (
                     QtyStep == other.QtyStep ||
                     QtyStep != null &&
                     QtyStep.Equals(other.QtyStep)
                 ) &&
                 (
                     PipSize == other.PipSize ||
                     PipSize != null &&
                     PipSize.Equals(other.PipSize)
                 ) &&
                 (
                     PipValue == other.PipValue ||
                     PipValue != null &&
                     PipValue.Equals(other.PipValue)
                 ) &&
                 (
                     MinTick == other.MinTick ||
                     MinTick != null &&
                     MinTick.Equals(other.MinTick)
                 ) &&
                 (
                     LotSize == other.LotSize ||
                     LotSize != null &&
                     LotSize.Equals(other.LotSize)
                 ));
        }
Esempio n. 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 (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (MinQty != null)
         {
             hashCode = hashCode * 59 + MinQty.GetHashCode();
         }
         if (MaxQty != null)
         {
             hashCode = hashCode * 59 + MaxQty.GetHashCode();
         }
         if (QtyStep != null)
         {
             hashCode = hashCode * 59 + QtyStep.GetHashCode();
         }
         if (PipSize != null)
         {
             hashCode = hashCode * 59 + PipSize.GetHashCode();
         }
         if (PipValue != null)
         {
             hashCode = hashCode * 59 + PipValue.GetHashCode();
         }
         if (MinTick != null)
         {
             hashCode = hashCode * 59 + MinTick.GetHashCode();
         }
         if (LotSize != null)
         {
             hashCode = hashCode * 59 + LotSize.GetHashCode();
         }
         return(hashCode);
     }
 }