Struct WeekDay
A weekday with an optional ordinal, used in BYDAY recurrence rule parts
(RFC 5545 §3.3.10). For example, MO is Monday with no ordinal;
1MO is the first Monday; -1FR is the last Friday.
Inherited Members
Namespace: DRIT.Mail.Rfc.ICal
Assembly: DRIT.Mail.dll
Syntax
public readonly struct WeekDay
Constructors
View SourceWeekDay(DayOfWeek, int?)
Initializes a new instance of the WeekDay struct.
Declaration
public WeekDay(DayOfWeek day, int? ordinal)
Parameters
| Type | Name | Description |
|---|---|---|
| DayOfWeek | day | The day of week. |
| int? | ordinal | The ordinal (1-based) or null for all occurrences. |
Properties
View SourceDay
Gets the day of week.
Declaration
public DayOfWeek Day { get; }
Property Value
| Type | Description |
|---|---|
| DayOfWeek |
Ordinal
Gets the ordinal (1-based, positive for first/second/...; negative for last/ second-to-last/...), or null to match every occurrence of the weekday.
Declaration
public int? Ordinal { get; }
Property Value
| Type | Description |
|---|---|
| int? |
Methods
View SourceFormatDayName(DayOfWeek)
Formats a DayOfWeek as a two-letter abbreviation.
Declaration
public static string FormatDayName(DayOfWeek day)
Parameters
| Type | Name | Description |
|---|---|---|
| DayOfWeek | day | Specifies the day value. |
Returns
| Type | Description |
|---|---|
| string |
Parse(string)
Parses a BYDAY weekday token such as MO, 1MO, or -1FR.
Declaration
public static WeekDay Parse(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Specifies the text value. |
Returns
| Type | Description |
|---|---|
| WeekDay |
ParseDayName(string)
Parses a two-letter day-of-week abbreviation (MO, TU, WE, TH, FR, SA, SU).
Declaration
public static DayOfWeek ParseDayName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Specifies the name value. |
Returns
| Type | Description |
|---|---|
| DayOfWeek |
ToString()
Formats this weekday for iCalendar serialization (e.g. MO,
1MO, -1FR).
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |