/// <summary>
        /// Compares two events to see if the date and place are the same.
        /// </summary>
        /// <param name="obj">The event instance to compare against.</param>
        /// <returns>Relative position in the sort order.</returns>
        public int CompareTo(object obj)
        {
            var eventToCompare = obj as GedcomEvent;

            if (eventToCompare == null)
            {
                return(-1);
            }

            if (eventToCompare.Date == null && Date == null)
            {
                return(0);
            }

            if (eventToCompare.Date == null)
            {
                return(-1);
            }

            if (Date == null)
            {
                return(1);
            }

            var compare = GedcomDate.CompareByDate(Date, eventToCompare.Date);

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

            return(string.Compare(eventName, eventToCompare.eventName));
        }
示例#2
0
        /// <summary>
        /// Compares two events to see if the date and place are the same.
        /// </summary>
        /// <param name="eventToCompare">The event instance to compare against.</param>
        /// <returns>Relative position in the sort order.</returns>
        public int CompareTo(GedcomEvent eventToCompare)
        {
            if (eventToCompare == null)
            {
                return(-1);
            }

            if (eventToCompare.Date == null && Date != null)
            {
                return(-1);
            }

            if (Date == null && eventToCompare.Date != null)
            {
                return(-1);
            }

            var compare = GedcomDate.CompareByDate(Date, eventToCompare.Date);

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

            return(string.Compare(eventName, eventToCompare.eventName));
        }