/// <summary> /// Compares the specified object to this <see cref="ApproximateDateTime"/> /// object. /// </summary> /// /// <param name="other"> /// The date to be compared. /// </param> /// /// <returns> /// A 32-bit signed integer that indicates the relative order of the /// objects being compared. If the result is less than zero, the /// instance is less than <paramref name="other"/>. If the result is zero, /// the instance is equal to <paramref name="other"/>. If the result is /// greater than zero, the instance is greater than /// <paramref name="other"/>. /// </returns> /// public int CompareTo(LocalDateTime other) { if (ApproximateDate == null) { return(-1); } int result = ApproximateDate.CompareTo(other.Date); if (result != 0) { return(result); } if (ApproximateTime == null) { return(-1); } return(ApproximateTime.CompareTo(other.TimeOfDay)); }
/// <summary> /// Compares the specified object to this <see cref="ApproximateDateTime"/> /// object. /// </summary> /// /// <param name="other"> /// The date to be compared. /// </param> /// /// <returns> /// A 32-bit signed integer that indicates the relative order of the /// objects being compared. If the result is less than zero, the /// instance is less than <paramref name="other"/>. If the result is zero /// the instance is equal to <paramref name="other"/>. If the result is /// greater than zero, the instance is greater than /// <paramref name="other"/>. /// </returns> /// public int CompareTo(ApproximateDateTime other) { if (other == null) { return(1); } if (ApproximateDate == null) { if (other.ApproximateDate != null) { return(-1); } return(Description.CompareTo(other.Description)); } int result = ApproximateDate.CompareTo(other.ApproximateDate); if (result != 0) { return(result); } if (ApproximateTime == null) { if (other.ApproximateTime != null) { return(-1); } return(0); } return(ApproximateTime.CompareTo(other.ApproximateTime)); }