/// <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 (CountryCodes != null) { hash = hash * 59 + CountryCodes.GetHashCode(); } if (BettingTypes != null) { hash = hash * 59 + BettingTypes.GetHashCode(); } if (TurnInPlayEnabled != null) { hash = hash * 59 + TurnInPlayEnabled.GetHashCode(); } if (MarketTypes != null) { hash = hash * 59 + MarketTypes.GetHashCode(); } if (Venues != null) { hash = hash * 59 + Venues.GetHashCode(); } if (MarketIds != null) { hash = hash * 59 + MarketIds.GetHashCode(); } if (EventTypeIds != null) { hash = hash * 59 + EventTypeIds.GetHashCode(); } if (EventIds != null) { hash = hash * 59 + EventIds.GetHashCode(); } if (BspMarket != null) { hash = hash * 59 + BspMarket.GetHashCode(); } return(hash); } }
/// <summary> /// Returns true if MarketFilter instances are equal /// </summary> /// <param name="other">Instance of MarketFilter to be compared</param> /// <returns>Boolean</returns> public bool Equals(MarketFilter other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return((CountryCodes == other.CountryCodes || CountryCodes != null && CountryCodes.SequenceEqual(other.CountryCodes)) && (BettingTypes == other.BettingTypes || BettingTypes != null && BettingTypes.SequenceEqual(other.BettingTypes)) && (TurnInPlayEnabled == other.TurnInPlayEnabled || TurnInPlayEnabled != null && TurnInPlayEnabled.Equals(other.TurnInPlayEnabled)) && (MarketTypes == other.MarketTypes || MarketTypes != null && MarketTypes.SequenceEqual(other.MarketTypes)) && (Venues == other.Venues || Venues != null && Venues.SequenceEqual(other.Venues)) && (MarketIds == other.MarketIds || MarketIds != null && MarketIds.SequenceEqual(other.MarketIds)) && (EventTypeIds == other.EventTypeIds || EventTypeIds != null && EventTypeIds.SequenceEqual(other.EventTypeIds)) && (EventIds == other.EventIds || EventIds != null && EventIds.SequenceEqual(other.EventIds)) && (BspMarket == other.BspMarket || BspMarket != null && BspMarket.Equals(other.BspMarket))); }
public MarketFilter WithMarketId(string marketId) { MarketIds ??= new HashSet <string>(); MarketIds.Add(marketId); return(this); }