Пример #1
0
        /// <summary>
        /// Returns true if TradesVolumes instances are equal
        /// </summary>
        /// <param name="other">Instance of TradesVolumes to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TradesVolumes other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CallsVolume == other.CallsVolume ||
                     CallsVolume != null &&
                     CallsVolume.Equals(other.CallsVolume)
                     ) &&
                 (
                     PutsVolume == other.PutsVolume ||
                     PutsVolume != null &&
                     PutsVolume.Equals(other.PutsVolume)
                 ) &&
                 (
                     CurrencyPair == other.CurrencyPair ||

                     CurrencyPair.Equals(other.CurrencyPair)
                 ) &&
                 (
                     FuturesVolume == other.FuturesVolume ||
                     FuturesVolume != null &&
                     FuturesVolume.Equals(other.FuturesVolume)
                 ));
        }
Пример #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 (CallsVolume != null)
                {
                    hashCode = hashCode * 59 + CallsVolume.GetHashCode();
                }
                if (PutsVolume != null)
                {
                    hashCode = hashCode * 59 + PutsVolume.GetHashCode();
                }

                hashCode = hashCode * 59 + CurrencyPair.GetHashCode();
                if (FuturesVolume != null)
                {
                    hashCode = hashCode * 59 + FuturesVolume.GetHashCode();
                }
                return(hashCode);
            }
        }