Export (0) Print
Expand All

DateTime.IComparable.CompareTo Method

.NET Framework 4.5

Compares the current instance with another object of the same type and returns an integer that indicates whether this instance precedes, follows, or occurs in the same position in the sort order as the other object.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Private Function CompareTo ( _
	value As Object _
) As Integer Implements IComparable.CompareTo

Parameters

value
Type: System.Object

An object to compare with this instance, or Nothing.

Return Value

Type: System.Int32
A signed number indicating the relative order of this instance and value.

Value

Description

Less than zero

This instance precedes value in the sort order.

Zero

This instance occurs in the same position as value in the sort order.

Greater than zero

This instance follows value in the sort order, or value is Nothing.

Implements

IComparable.CompareTo(Object)

ExceptionCondition
ArgumentException

value is not a DateTime.

This member is an explicit interface implementation. It can be used only when the DateTime instance is cast to an IComparable interface.

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8
Show:
© 2014 Microsoft