Click or drag to resize
StringCompareTo Method (Object)
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) Version: 4.0.0.0
Syntax
C#
public int CompareTo(
	Object value
)

Parameters

value
Type: SystemObject
An object that evaluates to a String.

Return Value

Type: 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 null.
Exceptions
ExceptionCondition
ArgumentExceptionvalue is not a String.
See Also