Exemplo n.º 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MarketChange" /> class.
 ///     Initializes a new instance of the <see cref="MarketChange" />class.
 /// </summary>
 /// <param name="Rc">Runner Changes - a list of changes to runners (or null if un-changed).</param>
 /// <param name="Img">Image - replace existing prices / data with the data supplied: it is not a delta (or null if delta).</param>
 /// <param name="Tv">The total amount matched across the market. This value is truncated at 2dp (or null if un-changed).</param>
 /// <param name="Con">Conflated - have more than a single change been combined (or null if not conflated).</param>
 /// <param name="MarketDefinition">Market Definition - the definition of the market (or null if un-changed).</param>
 /// <param name="Id">Market Id - the id of the market.</param>
 public MarketChange(
     List <RunnerChange> Rc = null,
     bool?Img  = null,
     double?Tv = null,
     bool?Con  = null,
     MarketDefinition MarketDefinition = null,
     string Id = null)
 {
     this.Rc  = Rc;
     this.Img = Img;
     this.Tv  = Tv;
     this.Con = Con;
     this.MarketDefinition = MarketDefinition;
     this.Id = Id;
 }
Exemplo n.º 2
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 (Rc != null)
                {
                    hash = hash * 59 + Rc.GetHashCode();
                }

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

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

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

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

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

                return(hash);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Returns true if MarketChange instances are equal
        /// </summary>
        /// <param name="other">Instance of MarketChange to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MarketChange other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Rc == other.Rc || Rc != null && Rc.SequenceEqual(other.Rc)) &&
                   (Img == other.Img || Img != null && Img.Equals(other.Img)) &&
                   (Tv == other.Tv || Tv != null && Tv.Equals(other.Tv)) &&
                   (Con == other.Con || Con != null && Con.Equals(other.Con)) &&
                   (MarketDefinition == other.MarketDefinition || MarketDefinition != null && MarketDefinition.Equals(other.MarketDefinition)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)));
        }