Struct DateRange
Data structure that represents a range of dates.
Implements
Inherited Members
Namespace: Unity.AppUI.Core
Assembly: Unity.AppUI.dll
Syntax
[Serializable]
public struct DateRange : IEquatable<DateRange>
Constructors
DateRange(DateTime, DateTime)
Declaration
public DateRange(DateTime start, DateTime end)
Parameters
Type | Name | Description |
---|---|---|
DateTime | start | The start DateTime. |
DateTime | end | The end DateTime. |
DateRange(Date, Date)
Constructs a DateRange from a start and end date.
Declaration
public DateRange(Date start, Date end)
Parameters
Type | Name | Description |
---|---|---|
Date | start | The start date. |
Date | end | The end date. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the start date is greater than the end date. |
Properties
end
The end date of the range.
Declaration
public Date end { get; }
Property Value
Type | Description |
---|---|
Date |
start
The start date of the range.
Declaration
public Date start { get; }
Property Value
Type | Description |
---|---|
Date |
Methods
Contains(Date, bool)
Determines whether the range contains a date.
Declaration
public bool Contains(Date date, bool includeStartAndEnd = true)
Parameters
Type | Name | Description |
---|---|---|
Date | date | The date to check. |
bool | includeStartAndEnd | Whether to include the start and end dates. |
Returns
Type | Description |
---|---|
bool | Whether the range contains the date. |
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | Whether the specified object is equal to the current object. |
Overrides
Equals(DateRange)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(DateRange other)
Parameters
Type | Name | Description |
---|---|---|
DateRange | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | Whether the specified object is equal to the current object. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
ToString()
Returns a string that represents the current DateRange.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current DateRange. |
Overrides
TryParse(string, out DateRange)
Try to parse a string into a DateRange.
Declaration
public static bool TryParse(string value, out DateRange dateRange)
Parameters
Type | Name | Description |
---|---|---|
string | value | The string to parse. |
DateRange | dateRange | The parsed DateRange. |
Returns
Type | Description |
---|---|
bool | Whether the string was successfully parsed. |
Operators
operator ==(DateRange, DateRange)
Determines whether two DateRanges are equal.
Declaration
public static bool operator ==(DateRange left, DateRange right)
Parameters
Type | Name | Description |
---|---|---|
DateRange | left | The first DateRange to compare. |
DateRange | right | The second DateRange to compare. |
Returns
Type | Description |
---|---|
bool | Whether the two DateRanges are equal. |
operator !=(DateRange, DateRange)
Determines whether two DateRanges are not equal.
Declaration
public static bool operator !=(DateRange left, DateRange right)
Parameters
Type | Name | Description |
---|---|---|
DateRange | left | The first DateRange to compare. |
DateRange | right | The second DateRange to compare. |
Returns
Type | Description |
---|---|
bool | Whether the two DateRanges are not equal. |