The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Char.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 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


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


Less than zero

This instance precedes value in the sort order.


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

Greater than zero

This instance follows value in the sort order.


value is null.




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

.NET for Windows Store apps

Supported in: Windows 8
© 2014 Microsoft