Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Char.IComparable.CompareTo Method

.NET Framework 4.6 and 4.5

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

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

int IComparable.CompareTo(
	Object value
)

Parameters

value
Type: System.Object

An object to compare this instance to, or null.

Return Value

Type: System.Int32
A signed integer that indicates the position of this instance in the sort order in relation to the value parameter.

Return value

Description

Less than zero

This instance precedes value in the sort order.

Zero

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

Greater than zero

This instance follows value in the sort order.

-or-

value is null.

Implements

IComparable.CompareTo(Object)

ExceptionCondition
ArgumentException

value is not a Char object.

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

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft