Share via


CompareTo Method

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

Compares this instance to a specified object and returns an indication of their relative values.

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

Syntax

'Declaration
Public Function CompareTo ( _
    value As Object _
) As Integer
public int CompareTo(
    Object value
)
public:
int CompareTo(
    Object^ value
)
member CompareTo : 
        value:Object -> int 
public function CompareTo(
    value : Object
) : int

Parameters

  • value
    Type: System. . :: . .Object
    An object to compare, or nullNothingnullptrunita null reference (Nothing in Visual Basic).

Return Value

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

Return value

Description

A negative integer

This instance is less than value.

Zero

This instance is equal to value.

A positive integer

This instance is greater than value, or value is nullNothingnullptrunita null reference (Nothing in Visual Basic).

Remarks

Any instance of Guid, regardless of its value, is considered greater than null Nothing nullptr unit a null reference (Nothing in Visual Basic) .

The value parameter must be null Nothing nullptr unit a null reference (Nothing in Visual Basic) or an instance of Guid; otherwise, an exception is thrown.

.NET Framework Security

See Also

Reference

Guid Structure

System Namespace