HandCoded.Finance.Date.CompareTo C# (CSharp) Method

CompareTo() public method

Returns the result of comparing this instance to another Date.
public CompareTo ( Date other ) : int
other Date The Date instance to compare with.
return int
        public int CompareTo(Date other)
        {
            if ((timeZone == null) && (other.timeZone == null))
                return (dateValue.CompareTo (other.dateValue));
            else if ((timeZone != null) && (other.timeZone != null) && timeZone.Equals (other.timeZone))
                return (dateValue.CompareTo (other.dateValue));
            else
                return (ToDateTime ().CompareTo (other.ToDateTime ()));
        }

Same methods

Date::CompareTo ( Object other ) : int

Usage Example

Exemplo n.º 1
0
 /// <summary>
 /// Compares two <see cref="Date"/> instances to determine if the
 /// first is equal to or smaller than the second.
 /// </summary>
 /// <param name="lhs">The first date.</param>
 /// <param name="rhs">The second date.</param>
 /// <returns><c>true</c> if the first value is less than the second.</returns>
 public static bool LessOrEqual(Date lhs, Date rhs)
 {
     return (lhs.CompareTo (rhs) <= 0);
 }
All Usage Examples Of HandCoded.Finance.Date::CompareTo