Windows apps
Collapse the table of content
Expand the table of content

CompareTo Method (Object)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Compares this instance with a specified Object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified Object.

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

public:
virtual int CompareTo(
	Object^ value
) sealed

Parameters

value
Type: System..::..Object
An object that evaluates to a String.

Return Value

Type: System..::..Int32
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter.

Value

Condition

Less than zero

This instance precedes value.

Zero

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

Greater than zero

This instance follows value.

-or-

value is nullNothingnullptrunita null reference (Nothing in Visual Basic).

Implements

IComparable..::..CompareTo(Object)

value must be a String object.

Show:
© 2017 Microsoft