/// <summary> /// Serialization constructor. /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected HolidayCalendar(SerializationInfo info, StreamingContext context) : base(info, context) { int version; try { version = info.GetInt32("version"); } catch { version = 0; } switch (version) { case 0: object o = info.GetValue("dates", typeof(object)); TreeSet oldTreeset = o as TreeSet; if (oldTreeset != null) { foreach (DateTime dateTime in oldTreeset) { dates.Add(dateTime); } } else { // must be generic treeset dates = (TreeSet<DateTime>) o; } break; case 1: dates = (TreeSet<DateTime>) info.GetValue("dates", typeof(TreeSet<DateTime>)); break; default: throw new NotSupportedException("Unknown serialization version"); } }
/// <summary> /// Returns a portion of the list whose elements are greater than the limit object parameter. /// </summary> /// <param name="limit">The start element of the portion to extract.</param> /// <returns>The portion of the collection whose elements are greater than the limit object parameter.</returns> public ISortedSet TailSet(object limit) { ISortedSet newList = new TreeSet(); int i = 0; while ((i < Count) && (comparator.Compare(this[i], limit) < 0)) { i++; } for (; i < Count; i++) { newList.Add(this[i]); } return newList; }