CalendarComponent Class

A component of an iCalendar object (BEGIN:NAME ... END:NAME): its properties, in their order, and its components. The typed components (VEvent, VTodo, VTimeZone) read and write their properties through it, so that a component written back keeps the properties they do not know.

public class CalendarComponent

Constructors

NameDescription
CalendarComponent(string)Creates a component.

CalendarComponent(string)

CalendarComponent.cs

Creates a component.

public CalendarComponent(string name)

Parameters

name string
The name of the component, such as VEVENT, VALARM or X-CUSTOM.

Properties

NameDescription
CalendarGets the calendar the component is in, when it was read from one or added to one.
ComponentsGets the components, such as the events of a calendar or the alarms of an event.
NameGets the name of the component.
PropertiesGets the properties.

Gets the calendar the component is in, when it was read from one or added to one.

public VCalendar? Calendar { get; }

Property value

VCalendar?

Gets the components, such as the events of a calendar or the alarms of an event.

public IList<CalendarComponent> Components { get; }

Gets the name of the component.

public string Name { get; }

Property value

string

Gets the properties.

public IList<ContentLine> Properties { get; }

Property value

IList<ContentLine>

Methods

NameDescription
GetDateTime(string)Returns the date or the date and time of a property.
GetProperties(string)Returns the properties of a name.
GetProperty(string)Returns the first property of a name.
GetText(string)Returns the text of a property, decoded.
RemoveProperties(string)Removes the properties of a name.
SetDateTime(string, CalendarDateTime?)Sets the date or the date and time of a property, or removes it.
SetText(string, string?)Sets the text of a property, or removes the properties of this name when the value is null.
SetValue(string, string?)Sets the value of a property, as it is written, or removes the properties of this name when the value is null.
ToString()Returns the component as it is written, with CRLF line breaks.

GetDateTime(string)

CalendarComponent.cs

Returns the date or the date and time of a property.

public CalendarDateTime? GetDateTime(string name)

Parameters

name string
The name of the property, such as DTSTART.

Returns

CalendarDateTime? The value, or null when the component does not have the property or its value is not a date.

GetProperties(string)

CalendarComponent.cs

Returns the properties of a name.

public IEnumerable<ContentLine> GetProperties(string name)

Parameters

name string
The name, without case.

Returns

IEnumerable<ContentLine> The properties.

GetProperty(string)

CalendarComponent.cs

Returns the first property of a name.

public ContentLine? GetProperty(string name)

Parameters

name string
The name, without case.

Returns

ContentLine? The property, or null.

GetText(string)

CalendarComponent.cs

Returns the text of a property, decoded.

public string? GetText(string name)

Parameters

name string
The name of the property.

Returns

string? The text, or null.

RemoveProperties(string)

CalendarComponent.cs

Removes the properties of a name.

public void RemoveProperties(string name)

Parameters

name string
The name, without case.

SetDateTime(string, CalendarDateTime?)

CalendarComponent.cs

Sets the date or the date and time of a property, or removes it.

public void SetDateTime(string name, CalendarDateTime? value)

Parameters

name string
The name of the property.
value CalendarDateTime?
The value.

SetText(string, string?)

CalendarComponent.cs

Sets the text of a property, or removes the properties of this name when the value is null.

public void SetText(string name, string? value)

Parameters

name string
The name of the property.
value string?
The text.

SetValue(string, string?)

CalendarComponent.cs

Sets the value of a property, as it is written, or removes the properties of this name when the value is null.

public void SetValue(string name, string? value)

Parameters

name string
The name of the property.
value string?
The value.

Returns the component as it is written, with CRLF line breaks.

public override string ToString()

Returns

string The component.