Result If the first string is bigger, the result is 1. If the first string is smaller, the result is -1.
And If both strings are equal, the result is 0. The number essentially indicates how much "larger" the first string is.
static void Main()
string a = "a";
string b = "b";
// Part A: use static Compare.
int c = string.Compare(a, b);
// Part B: use static CompareOrdinal.
c = string.CompareOrdinal(b, a);
// Part C: use CompareTo.
c = a.CompareTo(b);
c = b.CompareTo(a);
}-1 (This means a is smaller than b)
1 (This means b is smaller than a)
Review, results. It is important to understand the possible results of Compare methods. Here are the int return values—we see just 3 values: -1, zero, and 1.