Skip to main content

DateTimeRange Members

The date-time range.

Constructors

Name Description
DateTimeRange(DateTime, DateTime) Initializes a new DateTimeRange instance with the specified start and end dates.
DateTimeRange(DateTime, TimeSpan) Initializes a new DateTimeRange instance with the specified start date and duration.

Properties

Name Description
Duration Returns the duration of the range.
Empty static Returns an empty date-time range.
End Returns the end date-time value of the range.
IsEmpty Returns whether the range’s start and end values equal to DateTime.MinValue.
IsValid Returns whether the end value is larger than or equal to the start value.
Start Returns the end date-time value of the range.
Today static Returns an date-time range that specifies today.

Methods

Name Description
Contains(DateTimeRange) Checks whether the current range contains the specified date-time range.
Contains(DateTime) Checks whether the range contains the specified date-time value.
Equals(DateTimeRange) Determines whether the current range is equal to the specified range.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Determines whether the range is equal to the specified object.
GetHashCode() Serves as the default hash function.
GetType() Gets the Type of the current instance. Inherited from Object.
Intersect(DateTimeRange, DateTimeRange) static Computes the intersection of the specified ranges.
Intersect(DateTimeRange) Computes the intersection of the current range with the specified range.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
ToString() Returns a string that represents the range.
ToString(IFormatProvider) Returns a string that represents the range and formatted using the specified culture-specific formatting information.
ToString(String, IFormatProvider) Returns a string that represents the range and formatted using the specified format string and culture-specific formatting information.
TryParse(String, CultureInfo, out DateTimeRange) static Tries to parse the specified string and convert it into the date-time range.
Union(DateTimeRange, DateTimeRange) static Computes the union of the specified ranges.
Union(DateTimeRange) Computes the union of the current range and the specified range.

Operators

Name Description
Equality(DateTimeRange, DateTimeRange) static Determines whether two specified ranges have the same value.
Inequality(DateTimeRange, DateTimeRange) static Determines whether two specified ranges have different values.
See Also