コード例 #1
0
ファイル: TimeSlotRow.cs プロジェクト: runnane/PrtgAPI
        /// <summary>
        /// Compares the current instance with another object of the same type and returns an integer that
        /// indicates whether the current instance precedes, follows, or occurs in the same position in the
        /// sort order as the other object.
        /// </summary>
        /// <param name="other">The object to compare with this instance.</param>
        /// <returns>A value that indicates the relative order of the objects being compared.</returns>
        public int CompareTo(TimeSlotRow other)
        {
            if (other == null)
            {
                return(1);
            }

            var hourComparison = Hour.CompareTo(other.Hour);

            if (hourComparison != 0)
            {
                return(hourComparison);
            }

            var mondayComparison = Monday.CompareTo(other.Monday);

            if (mondayComparison != 0)
            {
                return(mondayComparison);
            }

            var tuesdayComparison = Tuesday.CompareTo(other.Tuesday);

            if (tuesdayComparison != 0)
            {
                return(tuesdayComparison);
            }

            var wednesdayComparison = Wednesday.CompareTo(other.Wednesday);

            if (wednesdayComparison != 0)
            {
                return(wednesdayComparison);
            }

            var thursdayComparison = Thursday.CompareTo(other.Thursday);

            if (thursdayComparison != 0)
            {
                return(thursdayComparison);
            }

            var fridayComparison = Friday.CompareTo(other.Friday);

            if (fridayComparison != 0)
            {
                return(fridayComparison);
            }

            var saturdayComparison = Saturday.CompareTo(other.Saturday);

            if (saturdayComparison != 0)
            {
                return(saturdayComparison);
            }

            return(Sunday.CompareTo(other.Sunday));
        }