Mono Class Library: System.String Overview | Members

System.String.CompareOrdinal Method

Compares two specified string objects based on the code points of the contained Unicode characters. [Edit]

public static int CompareOrdinal (string strA, string strB)

Parameters

strA
The first string to compare. [Edit]
strB
The second string to compare. [Edit]

Returns

The return value is a negative number, zero, or a positive number reflecting the sort order of the specified strings. For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value:

ValueDescription
A negative numberstrA is < strB, or strA is a null reference.
ZerostrA == strB, or both strA and strB are null references.
A positive numberstrA is > strB, or strB is a null reference.
[Edit]

Remarks

Note:

The result of comparing any string (including the empty string) to a null reference is greater than zero. The result of comparing two null references is zero. Uppercase letters evaluate greater than their lowercase equivalents.

The method uses the culture (if any) of the current thread to determine the ordering of individual characters. The two strings are compared on a character-by-character basis.

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0