When overridden in a derived class, compares two objects and returns an indication of their relative sort order.
![]()
A signed integer that indicates the relative values of x and y, as shown in the following table.
Less than zero x is less than y.
-or-
x is null.
Zero x is equal to y.
Greater than zero x is greater than y.
-or-
y is null.
The StringComparer.Compare(string, string) method is more efficient than the StringComparer.Compare(object, object) method because the x and y parameters do not have to be unboxed to perform the comparison.