/// <summary> /// Compared the value of the <see cref="Mileage"/> property with that of another <see cref="Location"/> instance. /// </summary> /// <param name="other">A <see cref="Location"/> object to compare.</param> /// <returns>An integer indicating whether the <see cref="Mileage"/> property of this object is less than, equal to or greater than that of the parameter.</returns> public int CompareTo(Location other) { if (other is null || other.Mileage == null) { return(Mileage == null ? 0 : 1); } if (Mileage == null) { return(-1); } return(Mileage.CompareTo(other.Mileage)); }
/// <summary> /// Compares the value of the <see cref="Mileage"/> property with a <see cref="Distance"/> parameter. /// </summary> /// <param name="other">A <see cref="Distance"/> parameter to compare.</param> /// <returns>An integer indicating whether the <see cref="Mileage"/> property is less than, equal to or greater than the parameter.</returns> public int CompareTo(Distance other) { if (other is null) { return(Mileage == null ? 0 : 1); } if (Mileage == null) { return(-1); } return(Mileage.CompareTo(other)); }