Skip to content

Deserialize an ics file

Rian Stockbower edited this page Nov 24, 2017 · 5 revisions

ics files are like containers: they can contain one or more VCALENDARs, and each VCALENDAR can contain many elements.

Deserializing a single VCALENDAR

var calendar = Calendar.Load(icalText);

Deserialize many calendars:

var manyCalendars = CalendarCollection.Load(severalCalendarsText);

Deserialize a calendar subcomponent:

With v4, it's now possible to deserialize smaller entities like CalendarEvents:

const string veventText = @"BEGIN:VEVENT
CREATED:20060717T210517Z
LAST-MODIFIED:20060717T210718Z
DTSTAMP:20060717T210718Z
UID:uuid1153170430406
SUMMARY:Test event
DTSTART:20060718T100000
DTEND:20060718T110000
LOCATION:Daywest
END:VEVENT";

var calendarEvent = Calendar.Load<CalendarEvent>(veventTest);