示例#1
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 :)

                hashCode = hashCode * 59 + TravelTime.GetHashCode();

                hashCode = hashCode * 59 + Distance.GetHashCode();
                if (DistanceBreakdown != null)
                {
                    hashCode = hashCode * 59 + DistanceBreakdown.GetHashCode();
                }
                if (Fares != null)
                {
                    hashCode = hashCode * 59 + Fares.GetHashCode();
                }
                if (Route != null)
                {
                    hashCode = hashCode * 59 + Route.GetHashCode();
                }
                return(hashCode);
            }
        }
示例#2
0
        /// <summary>
        /// Returns true if ResponseTimeFilterProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ResponseTimeFilterProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ResponseTimeFilterProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TravelTime == other.TravelTime ||

                     TravelTime.Equals(other.TravelTime)
                     ) &&
                 (
                     Distance == other.Distance ||

                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     DistanceBreakdown == other.DistanceBreakdown ||
                     DistanceBreakdown != null &&
                     other.DistanceBreakdown != null &&
                     DistanceBreakdown.SequenceEqual(other.DistanceBreakdown)
                 ) &&
                 (
                     Fares == other.Fares ||
                     Fares != null &&
                     Fares.Equals(other.Fares)
                 ) &&
                 (
                     Route == other.Route ||
                     Route != null &&
                     Route.Equals(other.Route)
                 ));
        }