Show / Hide Table of Contents

Class CalendarExtensions

Contains extension methods related to the calendar.

Inheritance
System.Object
CalendarExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public static class CalendarExtensions

Methods

Add(Calendar, DateTime)

Adds the given calendar day and returns one or more new calendar entities representing the new data.

Declaration
public static IEnumerable<Calendar> Add(this Calendar calendar, DateTime day)
Parameters
Calendar calendar

System.DateTime day

Returns
System.Collections.Generic.IEnumerable<Calendar>

AddOrSubtract(Calendar, CalendarDate)

Adds or subtracts the given calendar date and returns one or more new calendar entities representing the same data.

Declaration
public static IEnumerable<Calendar> AddOrSubtract(this Calendar calendar, CalendarDate calendarDate)
Parameters
Calendar calendar

CalendarDate calendarDate

Returns
System.Collections.Generic.IEnumerable<Calendar>

ContainsDay(Calendar, DayOfWeek)

Returns true if this Calendar is true for the specified DayOfWeek.

Declaration
public static bool ContainsDay(this Calendar _self, DayOfWeek day)
Parameters
Calendar _self

System.DayOfWeek day

Returns
System.Boolean

CopyWeekPatternFrom(Calendar, Calendar)

Copies the week pattern from the given calendar.

Declaration
public static void CopyWeekPatternFrom(this Calendar calendar, Calendar weekPatternSource)
Parameters
Calendar calendar

Calendar weekPatternSource

CoversDate(Calendar, DateTime)

Returns true if the calendar covers the given date.

Declaration
public static bool CoversDate(this Calendar calendar, DateTime date)
Parameters
Calendar calendar

System.DateTime date

Returns
System.Boolean

CreateCalendar(DateTime, String)

Creates a calendar entity for the day.

Declaration
public static Calendar CreateCalendar(this DateTime day, string serviceId)
Parameters
System.DateTime day

System.String serviceId

Returns
Calendar

FirstDayOfWeek(DateTime)

Gets the first day of the week that contains the given day.

Declaration
public static DateTime FirstDayOfWeek(this DateTime day)
Parameters
System.DateTime day

Returns
System.DateTime

Remarks

First day of the week is monday, last day is sunday.

GetServicesForDate(List<Calendar>, DateTime)

Returns the calendars in this list that covers the specified date and its DayOfWeek.

Declaration
public static List<Calendar> GetServicesForDate(this List<Calendar> calendars, DateTime dt)
Parameters
System.Collections.Generic.List<Calendar> calendars

System.DateTime dt

Returns
System.Collections.Generic.List<Calendar>

GetServicesForDayOfWeek(List<Calendar>, DayOfWeek, DateTime)

Returns the calendar entities in this list that covers the specified DayOfWeek. If the DateTime is specified it will also restrict the list of calendar's to cover the specified date.

Declaration
public static List<Calendar> GetServicesForDayOfWeek(this List<Calendar> calendars, DayOfWeek dow, DateTime dt = default (DateTime))
Parameters
System.Collections.Generic.List<Calendar> calendars

System.DayOfWeek dow

System.DateTime dt

Returns
System.Collections.Generic.List<Calendar>

GetStatusFor(Calendar, DateTime)

Gets the status for the given date, don't care, true or false.

Declaration
public static bool ? GetStatusFor(this Calendar calendar, DateTime date)
Parameters
Calendar calendar

System.DateTime date

Returns
System.Nullable<System.Boolean>

LastDayOfWeek(DateTime)

Gets the last day of the week that contains the given day.

Declaration
public static DateTime LastDayOfWeek(this DateTime day)
Parameters
System.DateTime day

Returns
System.DateTime

Remarks

First day of the week is monday, last day is sunday.

MaskForWeek(Calendar, DateTime)

Gets the mask for the given week. The mask will be adjusted when part of the week is outside of the calendar-range.

Declaration
public static byte MaskForWeek(this Calendar calendar, DateTime day)
Parameters
Calendar calendar

System.DateTime day

Returns
System.Byte

Set(Calendar, DateTime, Boolean)

Sets the mask for the given day.

Declaration
public static void Set(this Calendar calendar, DateTime day, bool value)
Parameters
Calendar calendar

System.DateTime day

System.Boolean value

Subtract(Calendar, DateTime)

Subtracts the given calendar day and returns one or more new calendar entities representing the same data.

Declaration
public static IEnumerable<Calendar> Subtract(this Calendar calendar, DateTime day)
Parameters
Calendar calendar

System.DateTime day

Returns
System.Collections.Generic.IEnumerable<Calendar>

TrimDates(Calendar)

Trims the end and start dates.

Declaration
public static void TrimDates(this Calendar calendar)
Parameters
Calendar calendar

TrimEndDate(Calendar)

Trims the end date when it's too late and the mask has trailing zero's.

Declaration
public static void TrimEndDate(this Calendar calendar)
Parameters
Calendar calendar

TrimStartDate(Calendar)

Trims the start date when it's too early and the mask has trailing zero's.

Declaration
public static void TrimStartDate(this Calendar calendar)
Parameters
Calendar calendar

TryMerge(Calendar, Calendar, out Calendar)

Tries to merge two calendars together.

Declaration
public static bool TryMerge(this Calendar calendar, Calendar other, out Calendar merge)
Parameters
Calendar calendar

Calendar other

Calendar merge

Returns
System.Boolean

Back to top Built by Itinero, MIT licensed.