Struct DateRange
Represents a range of dates, corresponding to the Apache Solr type
DateRangeField
.
A date range can have one or two bounds, namely lower bound and upper bound, to represent an interval of time. Date range bounds are both inclusive. For example:
[2015 TO 2016-10]
represents from the first day of 2015 to the last day of October 20162015
represents during the course of the year 2015.[2017 TO *]
represents any date greater or equals to the first day of the year 2017.
Note that this representation of DateRangeField
does not support Dates outside of the range
supported by DateTimeOffset
: from 1/1/0001 12:00:00 AM +00:00
to 12/31/9999 11:59:59 PM +00:00
.
Inherited Members
Namespace: Cassandra.DataStax.Search
Assembly: Cassandra.dll
Syntax
public struct DateRange : IEquatable<DateRange>, IComparable<DateRange>
Remarks
DateRange instances are immutable and thread-safe.
Constructors
DateRange(DateRangeBound)
Creates a new instance of DateRange using a lower bound and an upper bound.
Consider using Parse(string) to create instances more easily.
Declaration
public DateRange(DateRangeBound lowerBound)
Parameters
Type | Name | Description |
---|---|---|
DateRangeBound | lowerBound | A value representing the range lower bound, composed by a
|
DateRange(DateRangeBound, DateRangeBound)
Creates a new instance of DateRange using a lower bound and an upper bound.
Consider using Parse(string) to create instances more easily.
Declaration
public DateRange(DateRangeBound lowerBound, DateRangeBound upperBound)
Parameters
Type | Name | Description |
---|---|---|
DateRangeBound | lowerBound | A value representing the range lower bound, composed by a
|
DateRangeBound | upperBound | A value representing the range upper bound, composed by a
|
Properties
LowerBound
Gets the lower bound of this range (inclusive).
Declaration
public DateRangeBound LowerBound { get; }
Property Value
Type | Description |
---|---|
DateRangeBound |
UpperBound
Gets the upper bound of this range (inclusive).
Declaration
public DateRangeBound? UpperBound { get; }
Property Value
Type | Description |
---|---|
DateRangeBound? |
Methods
CompareTo(DateRange)
Compares the DateRange based to the bytes representation.
Declaration
public int CompareTo(DateRange other)
Parameters
Type | Name | Description |
---|---|---|
DateRange | other |
Returns
Type | Description |
---|---|
int |
Equals(DateRange)
Returns true if the value of this DateRange instance and other are the same.
Declaration
public bool Equals(DateRange other)
Parameters
Type | Name | Description |
---|---|---|
DateRange | other |
Returns
Type | Description |
---|---|
bool |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
Parse(string)
Returns the DateRange representation from a given string.
String representations of dates are always expressed in Coordinated Universal Time(UTC)
Declaration
public static DateRange Parse(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value |
Returns
Type | Description |
---|---|
DateRange |
Exceptions
Type | Condition |
---|---|
FormatException |
ToString()
Returns the string representation of the instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Operators
operator ==(DateRange, DateRange)
Compares value equality of 2 DateRange instances.
Declaration
public static bool operator ==(DateRange a, DateRange b)
Parameters
Type | Name | Description |
---|---|---|
DateRange | a | |
DateRange | b |
Returns
Type | Description |
---|---|
bool |
operator !=(DateRange, DateRange)
Compares value inequality of 2 DateRange instances.
Declaration
public static bool operator !=(DateRange a, DateRange b)
Parameters
Type | Name | Description |
---|---|---|
DateRange | a | |
DateRange | b |
Returns
Type | Description |
---|---|
bool |