public int CompareTo(object obj) { TaskOccurrence otherOccurrence = obj as TaskOccurrence; if (otherOccurrence == null) { throw new InvalidOperationException("Cannot compare to something that is not of the same type"); } return(this.OccurrenceMoment.CompareTo(otherOccurrence.OccurrenceMoment)); }
private DateTime GetLastTimeTaskWasPerformed() { TaskOccurrence lastOccurence = this.taskOccurrences.LastOrDefault(); if (lastOccurence != null) { return(lastOccurence.OccurrenceMoment); } else { return(default(DateTime)); } }