Noda Time
Show / Hide Table of Contents

Class OffsetDateTime.Comparer

Base class for OffsetDateTime comparers.
Since 1.1.x
Availability net35-Client, PCL
Inheritance
Object
OffsetDateTime.Comparer
Implements
IComparer<OffsetDateTime>
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public abstract class Comparer : IComparer<OffsetDateTime>
Remarks

Use the static properties of this class to obtain instances.

For the curious: this class only exists so that in the future, it can expose more functionality - probably implementing System.Collections.Generic.IEqualityComparer<T>. If we simply provided properties on OffsetDateTime of type System.Collections.Generic.IComparer<T> we'd have no backward-compatible way of adding to the set of implemented interfaces.

Properties

Instant

Returns a comparer which compares OffsetDateTime values by the instant values obtained by applying the offset to the local date/time, ignoring the calendar system.
Since 1.1.x
Availability net35-Client, PCL
Declaration
public static OffsetDateTime.Comparer Instant { get; }
Property Value
Type Description
OffsetDateTime.Comparer
Remarks

For example, this comparer considers 2013-03-04T20:21:00+0100 to be earlier than 2013-03-04T19:21:00-0700 even though the second value has a local time which is earlier.

This property will return a reference to the same instance every time it is called.

Local

Returns a comparer which compares OffsetDateTime values by their local date/time, without reference to either the offset or the calendar system.
Since 1.1.x
Availability net35-Client, PCL
Declaration
public static OffsetDateTime.Comparer Local { get; }
Property Value
Type Description
OffsetDateTime.Comparer
Remarks

For example, this comparer considers 2013-03-04T20:21:00+0100 to be later than 2013-03-04T19:21:00-0700 even though the second value represents a later instant in time.

This property will return a reference to the same instance every time it is called.

Methods

Compare(OffsetDateTime, OffsetDateTime)

Since 1.1.x
Availability net35-Client, PCL
Declaration
public abstract int Compare(OffsetDateTime x, OffsetDateTime y)
Parameters
Type Name Description
OffsetDateTime x
OffsetDateTime y
Returns
Type Description
Int32

Implements

System.Collections.Generic.IComparer<T>
In this article
Back to top Generated by DocFX