/// <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) )); }
/// <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); } }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (Category == null ? 0 : Category.GetHashCode()); hash = hash * 23 + (Description == null ? 0 : Description.GetHashCode()); hash = hash * 23 + (DiscountPct == default(decimal) ? 0 : DiscountPct.GetHashCode()); hash = hash * 23 + (EndDate == default(DateTime) ? 0 : EndDate.GetHashCode()); hash = hash * 23 + (MaxQty == null ? 0 : MaxQty.GetHashCode()); hash = hash * 23 + (MinQty == default(int) ? 0 : MinQty.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode()); hash = hash * 23 + (StartDate == default(DateTime) ? 0 : StartDate.GetHashCode()); hash = hash * 23 + (Type == null ? 0 : Type.GetHashCode()); return(hash); } }