public Calendar Clone() { var newCalender = new Calendar() { DaysToAlwaysExclude = DaysToAlwaysExclude.ToList(), InheritedCalendar = InheritedCalendar.ToList(), DaysToExclude = new HashSet <DateTime>(DaysToExclude), MonthsToExclude = MonthsToExclude.ToList(), Name = Name }; return(newCalender); }
public Calendar Merge(Calendar otherCalendar) { if (otherCalendar.CalendarType != CalendarType) { throw new Exception("Cannot merge calendars of differing types"); } var newCalender = new Calendar() { DaysToAlwaysExclude = DaysToAlwaysExclude.Concat(otherCalendar.DaysToAlwaysExclude).Distinct().ToList(), InheritedCalendar = InheritedCalendar.Concat(otherCalendar.InheritedCalendar).Distinct().ToList(), DaysToExclude = new HashSet <DateTime>(DaysToExclude.Concat(otherCalendar.DaysToExclude).Distinct()), MonthsToExclude = MonthsToExclude.Concat(otherCalendar.MonthsToExclude).Distinct().ToList(), Name = Name }; return(newCalender); }