89
C# String CompareOrdinal()
The C# CompareOrdinal() method compares two specified String objects by evaluating the numeric values of the corresponding Char objects in each string.
If both strings are equal, it returns 0. If first string is greater than second string, it returns positive number in difference else it returns negative number.
Rule
Signature
Parameters
first: first argument represents string which is to be compared with second string.
second: second argument represents string which is to be compared with first string.
Return
It returns an integer value.
C# String CompareOrdinal() Method Example
Output:
0 5 -5
Next TopicC# String CompareTo()