/// <summary> /// Compares this instance against another <see cref="Duration"/> instance based on the bytes representation /// of the values. /// </summary> public int CompareTo(Duration other) { var result = Months.CompareTo(other.Months); if (result != 0) { return(result); } result = Days.CompareTo(other.Days); if (result != 0) { return(result); } return(Nanoseconds.CompareTo(other.Nanoseconds)); }
public int CompareTo(object obj) { if (!(obj is Date)) { throw new ArgumentException("Object is not a Date"); } Date other = (Date)obj; if (years != other.years) { return(years.CompareTo(other.Years)); } if (Months != other.Months) { return(Months.CompareTo(other.Months)); } return(Days.CompareTo(other.Days)); }
public int CompareTo(object obj) { return(Months.CompareTo(((Date)obj).Months)); }