Class Calendar
An iCalendar (RFC 5545). Immutable after parsing. Construct via CalendarBuilder for writing.
Inherited Members
Namespace: DRIT.Mail.Rfc.ICal
Assembly: DRIT.Mail.dll
Syntax
public sealed class Calendar
Constructors
View SourceCalendar(string?, string?, string?, CalendarMethod, IReadOnlyList<CalendarEvent>, IReadOnlyList<Todo>, IReadOnlyList<Journal>, IReadOnlyList<FreeBusy>, IReadOnlyList<VTimeZone>, IReadOnlyList<ICalProperty>)
Initializes a new instance of the Calendar class.
Declaration
public Calendar(string? productId, string? version, string? calendarScale, CalendarMethod method, IReadOnlyList<CalendarEvent> events, IReadOnlyList<Todo> todos, IReadOnlyList<Journal> journals, IReadOnlyList<FreeBusy> freeBusyEntries, IReadOnlyList<VTimeZone> timeZones, IReadOnlyList<ICalProperty> extendedProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| string | productId | |
| string | version | |
| string | calendarScale | |
| CalendarMethod | method | |
| IReadOnlyList<CalendarEvent> | events | |
| IReadOnlyList<Todo> | todos | |
| IReadOnlyList<Journal> | journals | |
| IReadOnlyList<FreeBusy> | freeBusyEntries | |
| IReadOnlyList<VTimeZone> | timeZones | |
| IReadOnlyList<ICalProperty> | extendedProperties |
Properties
View SourceCalendarScale
Gets the calendar scale (CALSCALE), or null. Default is GREGORIAN.
Declaration
public string? CalendarScale { get; }
Property Value
| Type | Description |
|---|---|
| string |
Events
Gets the events (VEVENT). May be empty.
Declaration
public IReadOnlyList<CalendarEvent> Events { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<CalendarEvent> |
ExtendedProperties
Gets the X-* extension properties. May be empty.
Declaration
public IReadOnlyList<ICalProperty> ExtendedProperties { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<ICalProperty> |
FreeBusyEntries
Gets the free/busy entries (VFREEBUSY). May be empty.
Declaration
public IReadOnlyList<FreeBusy> FreeBusyEntries { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<FreeBusy> |
Journals
Gets the journal entries (VJOURNAL). May be empty.
Declaration
public IReadOnlyList<Journal> Journals { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<Journal> |
Method
Gets the calendar method (METHOD).
Declaration
public CalendarMethod Method { get; }
Property Value
| Type | Description |
|---|---|
| CalendarMethod |
ProductId
Gets the product identifier (PRODID), or null.
Declaration
public string? ProductId { get; }
Property Value
| Type | Description |
|---|---|
| string |
TimeZones
Gets the timezone definitions (VTIMEZONE). May be empty.
Declaration
public IReadOnlyList<VTimeZone> TimeZones { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<VTimeZone> |
Todos
Gets the to-do items (VTODO). May be empty.
Declaration
public IReadOnlyList<Todo> Todos { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<Todo> |
Version
Gets the iCalendar version (VERSION), or null.
Declaration
public string? Version { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceLoad(Stream)
Loads a single Calendar from the specified stream. If the stream contains multiple calendars, the first is returned.
Declaration
public static Calendar Load(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream used to read or write the data. |
Returns
| Type | Description |
|---|---|
| Calendar |
Load(string)
Loads a single Calendar from the specified file. If the file contains multiple calendars, the first is returned.
Declaration
public static Calendar Load(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The file or path to process. |
Returns
| Type | Description |
|---|---|
| Calendar |
LoadAll(Stream)
Loads all calendars from the specified stream.
Declaration
public static IReadOnlyList<Calendar> LoadAll(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream used to read or write the data. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<Calendar> |
LoadAll(string)
Loads all calendars from the specified file.
Declaration
public static IReadOnlyList<Calendar> LoadAll(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The file or path to process. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<Calendar> |
Write(Stream)
Writes this calendar to the specified stream.
Declaration
public void Write(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream used to read or write the data. |
Write(string)
Writes this calendar to the specified file.
Declaration
public void Write(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The file or path to process. |