It is possible to import recurrence patterns from Aspose.Recurrence XML format into Aspose.iCalendar patterns.
However, there are some differences in the way the two products generate occurrence dates that sometimes produce different results. See the posts below for more info.
Code Example
///
/// Testing import from XML by Recurrence component (YearlyDayOfWeek)
///
[Test]public void TestFromRecurrenceYearlyDayOfWeek()
{
XmlSerializer ser = new XmlSerializer(typeof(YearlyDayOfWeek));
StringBuilder sb = new StringBuilder();
StringWriter stream = new StringWriter(sb);
//Create Aspose.Recurrence pattern, first friday of April, every 3 years.
YearlyDayOfWeek recur = new YearlyDayOfWeek(3, 4, NthOccurrence.First, DayOfWeek.Friday);
DateTime startDate = new DateTime(2004, 6, 17, 0, 0, 0);
DateTime endDate = new DateTime(2003, 12, 31, 0, 0, 0);
recur.StartDate = startDate;
recur.EndDate = endDate;
recur.EndType = Recurrence.EndType.EndDate;
//Serialize Aspose.Recurrence pattern into XML
ser.Serialize(stream, recur);
//Load Aspose.iCalendar pattern from XML
RecurrencePattern pattern = RecurrencePattern.FromRecurrence(sb.ToString());
//Check Aspose.iCalendar pattern matches the old pattern.
Assert.AreEqual(
“DTSTART;TZID=US-Eastern:20040617T000000\n” +
“RRULE:FREQ=YEARLY;UNTIL=20031231T000000Z;INTERVAL=3;BYMONTH=4;BYDAY=1FR”,
pattern.ToiCalendar());
}