Struct DateTimeRange
Represents a span of time between specified by a start and end date.
Inherited Members
Namespace: TimeyWimey
Assembly: cs.temp.dll.dll
Syntax
public struct DateTimeRange : IEquatable<DateTimeRange>, IComparable<DateTimeRange>
Remarks
DateTimeRange instances are compared and sorted by their Start property, if the values are equal then they are compared by their End property. Values with the same start and end values are equal.
Constructors
Name | Description |
---|---|
DateTimeRange(DateTime, DateTime) | Creates a new DateTimeRange instance from two System.DateTime values. |
Properties
Name | Description |
---|---|
End | Returns the date and time this date range ends at. |
Length | Returns the length of the range as a System.TimeSpan instance. |
Start | Returns the date and time this date range starts at. |
Methods
Name | Description |
---|---|
CompareTo(DateTimeRange) | Compares this instance with another DateTimeRange instance. If the instances are equal, returns zero. If this instance is less than |
Contains(DateTime) | Returns true if the date and time specified by |
Contains(DateTimeRange) | Returns true if both the start and end properties of |
Create(DateTime, DateTime) | Creates a new DateTimeRange instance from two dates, using the earliest date as the start value. |
EndAt(DateTime) | Creates a new DateTimeRange instance using the Start value of this instance and a new value for End. |
Equals(Object) | Returns true if two instances are considered equal. Equality is checked by comparing the Start and End properties. |
Equals(DateTimeRange) | Returns true if two instances are considered equal. Equality is checked by comparing the Start and End properties. |
GetHashCode() | |
Overlaps(DateTimeRange) | Returns true if any part of the range specified by this instance overlaps with the range specified by |
StartAt(DateTime) | Creates a new DateTimeRange instance using the End value of this instance and a new value for Start. |
Operators
Name | Description |
---|---|
Equality(DateTimeRange, DateTimeRange) | Peforms an equality check, equivalent to calling Equals(DateTimeRange). |
GreaterThan(DateTimeRange, DateTimeRange) | Peforms an comparison, equivalent to; CompareTo(DateTimeRange) > 0. |
Inequality(DateTimeRange, DateTimeRange) | Peforms an inequality check, equivalent to calling !Equals(DateTimeRange). |
LessThan(DateTimeRange, DateTimeRange) | Peforms an comparison, equivalent to; CompareTo(DateTimeRange) < 0. |