Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct NodaTime.​Interval
Assembly: NodaTime
Implemented Interfaces
- System.​IEquatable`1
- System.​Xml.​Serialization.​IXmlSerializable
- System.​Numerics.​IEqualityOperators`3
An interval between two instants in time (start and end).
Remarks
<para>
Equality is defined in a component-wise fashion: two intervals are considered equal if their start instants are
equal to each other and their end instants are equal to each other. Ordering between intervals is not defined.
</para> <para>
The interval includes the start instant and excludes the end instant. However, an interval
may be missing its start or end, in which case the interval is deemed to be infinite in that
direction.
</para> <para>
The end may equal the start (resulting in an empty interval), but will not be before the start.
</para> <para>The default value of this type is an empty interval with a start and end of
<see cref="P:NodaTime.NodaConstants.UnixEpoch" />.</para>
Properties
public
Instant
Start
Gets the start instant - the inclusive lower bound of the interval.
Remarks This will never be later than <see cref="P:NodaTime.Interval.End" /> , though it may be equal to it.
public
bool
HasStart
Returns <c>true</c> if this interval has a fixed start point, or <c>false</c> if it
extends to the start of time.
public
Instant
End
Gets the end instant - the exclusive upper bound of the interval.
public
bool
HasEnd
Returns <c>true</c> if this interval has a fixed end point, or <c>false</c> if it
extends to the end of time.
public
Duration
Duration
Returns the duration of the interval.
Remarks This will always be a non-negative duration, though it may be zero.
Methods
public
bool
Contains​(Instant instant)
Returns whether or not this interval contains the given instant.
Returns True if this interval contains the given instant; false otherwise.
instant
Instant to test.
public
void
Deconstruct​(System.​Nullable`1& start,
System.​Nullable`1& end)
public
bool
Equals​(Interval other)
Indicates whether the value of this interval is equal to the value of the specified interval.
See the type documentation for a description of equality semantics.
Returns true if the value of this instant is equal to the value of the <paramref name="other" /> parameter;
otherwise, false.
other
The value to compare with this instance.
public
bool
Equals​(object obj)
Determines whether the specified <see cref="T:System.Object" /> is equal to this instance.
See the type documentation for a description of equality semantics.
Returns <c>true</c> if the specified <see cref="T:System.Object" /> is equal to this instance;
otherwise, <c>false</c> .
obj
The <see cref="T:System.Object" /> to compare with this instance.
public
int
GetHashCode​()
Returns the hash code for this instance.
See the type documentation for a description of equality semantics.
Returns A 32-bit signed integer that is the hash code for this instance.
public
string
ToString​()
Returns a string representation of this interval, in extended ISO-8601 format: the format
is "start/end" where each instant uses a format of "uuuu'-'MM'-'dd'T'HH':'mm':'ss;FFFFFFFFF'Z'".
If the start or end is infinite, the relevant part uses "StartOfTime" or "EndOfTime" to
represent this.
Returns A string representation of this interval.
AddSchema​(System.​Xml.​Schema.​XmlSchemaSet xmlSchemaSet)
Adds the XML schema type describing the structure of the <see cref="T:NodaTime.Interval" /> XML serialization to the given <paramref name="xmlSchemaSet" /> .
Returns The qualified name of the schema type that was added to the <paramref name="xmlSchemaSet" /> .
xmlSchemaSet
The XML schema set provided by <see cref="T:System.Xml.Serialization.XmlSchemaExporter" /> .
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object