DateOnly.CompareTo Method

Definition

Overloads

CompareTo(DateOnly)

Compares the value of this instance to a specified DateOnly value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value.

CompareTo(Object)

Compares the value of this instance to a specified object that contains a specified DateOnly value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value.

CompareTo(DateOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

Compares the value of this instance to a specified DateOnly value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value.

public int CompareTo (DateOnly value);

Parameters

value
DateOnly

The object to compare to the current instance.

Returns

Less than zero if this instance is earlier than value. Greater than zero if this instance is later than value. Zero if this instance is the same as value.

Implements

Applies to

.NET 9 and other versions
Product Versions
.NET 6, 7, 8, 9

CompareTo(Object)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

Compares the value of this instance to a specified object that contains a specified DateOnly value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value.

public int CompareTo (object? value);

Parameters

value
Object

A boxed object to compare, or null.

Returns

Less than zero if this instance is earlier than value. Greater than zero if this instance is later than value. Zero if this instance is the same as value.

Implements

Applies to

.NET 9 and other versions
Product Versions
.NET 6, 7, 8, 9