예제 #1
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Date != null)
         {
             hashCode = hashCode * 59 + Date.GetHashCode();
         }
         if (Rehabilitation != null)
         {
             hashCode = hashCode * 59 + Rehabilitation.GetHashCode();
         }
         if (TurnoverRate != null)
         {
             hashCode = hashCode * 59 + TurnoverRate.GetHashCode();
         }
         if (Per != null)
         {
             hashCode = hashCode * 59 + Per.GetHashCode();
         }
         if (Psr != null)
         {
             hashCode = hashCode * 59 + Psr.GetHashCode();
         }
         if (Pcfr != null)
         {
             hashCode = hashCode * 59 + Pcfr.GetHashCode();
         }
         if (Pbr != null)
         {
             hashCode = hashCode * 59 + Pbr.GetHashCode();
         }
         if (Stopped != null)
         {
             hashCode = hashCode * 59 + Stopped.GetHashCode();
         }
         if (SpecialTreatment != null)
         {
             hashCode = hashCode * 59 + SpecialTreatment.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #2
0
        /// <summary>
        ///     Returns true if DailyPrice instances are equal
        /// </summary>
        /// <param name="other">Instance of DailyPrice to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DailyPrice other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                (Equals((PriceBase)other) &&
                 (
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                 ) &&
                 (
                     PreClosing == other.PreClosing ||
                     PreClosing != null &&
                     PreClosing.Equals(other.PreClosing)
                 ) &&
                 (
                     Rehabilitation == other.Rehabilitation ||
                     Rehabilitation != null &&
                     Rehabilitation.Equals(other.Rehabilitation)
                 ) &&
                 (
                     TurnoverRate == other.TurnoverRate ||
                     TurnoverRate != null &&
                     TurnoverRate.Equals(other.TurnoverRate)
                 ) &&
                 (
                     Per == other.Per ||
                     Per != null &&
                     Per.Equals(other.Per)
                 ) &&
                 (
                     Psr == other.Psr ||
                     Psr != null &&
                     Psr.Equals(other.Psr)
                 ) &&
                 (
                     Pcfr == other.Pcfr ||
                     Pcfr != null &&
                     Pcfr.Equals(other.Pcfr)
                 ) &&
                 (
                     Pbr == other.Pbr ||
                     Pbr != null &&
                     Pbr.Equals(other.Pbr)
                 ) &&
                 (
                     Stopped == other.Stopped ||
                     Stopped != null &&
                     Stopped.Equals(other.Stopped)
                 ) &&
                 (
                     SpecialTreatment == other.SpecialTreatment ||
                     SpecialTreatment != null &&
                     SpecialTreatment.Equals(other.SpecialTreatment)
                 ));
        }