コード例 #1
0
        //=====================================================================

        /// <summary>
        /// Compares this instance to a specified object and returns an indication of their relative values
        /// </summary>
        /// <param name="obj">An object to compare or null</param>
        /// <returns>Returns -1 if this instance is less than the value, 0 if they are equal, or 1 if this
        /// instance is greater than the value or the value is null.</returns>
        /// <exception cref="ArgumentException">This is thrown if the object to be compared is not a
        /// <c>Period</c>.</exception>
        public int CompareTo(object obj)
        {
            Period p = obj as Period;

            if (p == null)
            {
                throw new ArgumentException(LR.GetString("ExPeriodBadCompareObject"));
            }

            return(Period.Compare(this, p));
        }
コード例 #2
0
 /// <summary>
 /// Overload for greater than or equal operator
 /// </summary>
 /// <param name="p1">The first period object</param>
 /// <param name="p2">The second period object</param>
 /// <returns>True if r1 is greater than or equal to r2, false if not</returns>
 public static bool operator >=(Period p1, Period p2)
 {
     return(Period.Compare(p1, p2) >= 0);
 }