Example #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 (Date != null)
                {
                    hashCode = hashCode * 59 + Date.GetHashCode();
                }
                if (Symbol != null)
                {
                    hashCode = hashCode * 59 + Symbol.GetHashCode();
                }
                if (Exchange != null)
                {
                    hashCode = hashCode * 59 + Exchange.GetHashCode();
                }

                hashCode = hashCode * 59 + Open.GetHashCode();

                hashCode = hashCode * 59 + High.GetHashCode();

                hashCode = hashCode * 59 + Low.GetHashCode();

                hashCode = hashCode * 59 + Close.GetHashCode();

                hashCode = hashCode * 59 + Volume.GetHashCode();

                hashCode = hashCode * 59 + AdjOpen.GetHashCode();

                hashCode = hashCode * 59 + AdjHigh.GetHashCode();

                hashCode = hashCode * 59 + AdjLow.GetHashCode();

                hashCode = hashCode * 59 + AdjClose.GetHashCode();

                hashCode = hashCode * 59 + AdjVolume.GetHashCode();
                return(hashCode);
            }
        }
Example #2
0
        /// <summary>
        /// Returns true if OutputMarketIndex instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputMarketIndex to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputMarketIndex other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Symbol == other.Symbol ||
                     Symbol != null &&
                     Symbol.Equals(other.Symbol)
                 ) &&
                 (
                     Exchange == other.Exchange ||
                     Exchange != null &&
                     Exchange.Equals(other.Exchange)
                 ) &&
                 (
                     Open == other.Open ||

                     Open.Equals(other.Open)
                 ) &&
                 (
                     High == other.High ||

                     High.Equals(other.High)
                 ) &&
                 (
                     Low == other.Low ||

                     Low.Equals(other.Low)
                 ) &&
                 (
                     Close == other.Close ||

                     Close.Equals(other.Close)
                 ) &&
                 (
                     Volume == other.Volume ||

                     Volume.Equals(other.Volume)
                 ) &&
                 (
                     AdjOpen == other.AdjOpen ||

                     AdjOpen.Equals(other.AdjOpen)
                 ) &&
                 (
                     AdjHigh == other.AdjHigh ||

                     AdjHigh.Equals(other.AdjHigh)
                 ) &&
                 (
                     AdjLow == other.AdjLow ||

                     AdjLow.Equals(other.AdjLow)
                 ) &&
                 (
                     AdjClose == other.AdjClose ||

                     AdjClose.Equals(other.AdjClose)
                 ) &&
                 (
                     AdjVolume == other.AdjVolume ||

                     AdjVolume.Equals(other.AdjVolume)
                 ));
        }