Exemplo n.º 1
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (BgHigh != null)
                {
                    hash = hash * 59 + BgHigh.GetHashCode();
                }

                if (BgTargetTop != null)
                {
                    hash = hash * 59 + BgTargetTop.GetHashCode();
                }

                if (BgTargetBottom != null)
                {
                    hash = hash * 59 + BgTargetBottom.GetHashCode();
                }

                if (BgLow != null)
                {
                    hash = hash * 59 + BgLow.GetHashCode();
                }

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

            return
                ((
                     BgHigh == other.BgHigh ||
                     BgHigh != null &&
                     BgHigh.Equals(other.BgHigh)
                     ) &&
                 (
                     BgTargetTop == other.BgTargetTop ||
                     BgTargetTop != null &&
                     BgTargetTop.Equals(other.BgTargetTop)
                 ) &&
                 (
                     BgTargetBottom == other.BgTargetBottom ||
                     BgTargetBottom != null &&
                     BgTargetBottom.Equals(other.BgTargetBottom)
                 ) &&
                 (
                     BgLow == other.BgLow ||
                     BgLow != null &&
                     BgLow.Equals(other.BgLow)
                 ));
        }