/// <summary> /// Returns true if ResponseBox instances are equal /// </summary> /// <param name="other">Instance of ResponseBox to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseBox other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( MinLat == other.MinLat || MinLat.Equals(other.MinLat) ) && ( MaxLat == other.MaxLat || MaxLat.Equals(other.MaxLat) ) && ( MinLng == other.MinLng || MinLng.Equals(other.MinLng) ) && ( MaxLng == other.MaxLng || MaxLng.Equals(other.MaxLng) )); }
/// <summary> /// Возвращает строку запроса типа ?min_lat=55.30077916694387&min_lng=36.974153699712836&max_lat=56.200586833056136&max_lng=38.26083830028717 /// </summary> /// <returns></returns> public string ToUrlQuery() { var list = new List <string>(15); if (!string.IsNullOrWhiteSpace(Id)) { list.Add($"id={Id}"); } if (WeightGramms > 0) { list.Add($"weight={WeightGramms.ToString()}"); } if (OrderPrice > 0) { list.Add($"order_price={OrderPrice.ToString()}"); } if (!string.IsNullOrWhiteSpace(City)) { list.Add($"city={City}"); } if (!string.IsNullOrWhiteSpace(Region)) { list.Add($"region={Region}"); } if (!string.IsNullOrWhiteSpace(CountryCode)) { list.Add($"country={CountryCode}"); } if (!string.IsNullOrWhiteSpace(Type)) { list.Add($"type={Type}"); } if (!string.IsNullOrWhiteSpace(Partner)) { list.Add($"partner={Partner}"); } if (MinLng.HasValue && MaxLng.HasValue && MinLat.HasValue && MaxLat.HasValue) { list.Add($"min_lng={MinLng.ToString().Replace(",", ".")}"); list.Add($"max_lng={MaxLng.ToString().Replace(",", ".")}"); list.Add($"min_lat={MinLat.ToString().Replace(",", ".")}"); list.Add($"max_lat={MaxLat.ToString().Replace(",", ".")}"); } if (RegionCities.HasValue) { list.Add($"region_cities={(RegionCities.Value ? "Y" : "N")}"); } if (!string.IsNullOrWhiteSpace(InSales)) { list.Add($"insales={InSales}"); } return("?" + string.Join("&", list)); }
/// <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 :) hashCode = hashCode * 59 + MinLat.GetHashCode(); hashCode = hashCode * 59 + MaxLat.GetHashCode(); hashCode = hashCode * 59 + MinLng.GetHashCode(); hashCode = hashCode * 59 + MaxLng.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { return(MinLat.GetHashCode() ^ MinLng.GetHashCode() ^ MaxLat.GetHashCode() ^ MaxLng.GetHashCode()); }