Share via


String.CompareTo Method (String)

Compares the current String object with a specified String object.

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

Syntax

[MethodImplAttribute]
public int CompareTo (
         stringstrB
)

Parameters

  • strB
    The specified String object.

Return Value

A 32-bit signed integer that indicates the lexical relationship between the two comparands.

Value Meaning
Less than 0 (zero) this is less than strB.
0 (zero) this equals strB.
Greater than 0 (zero) this is greater than strB.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

String Class
String Members
System Namespace