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.
string a = "a";
string b = "b";
// Part 1: use static Compare.
int c = string.Compare(a, b);
// Part 2: use static CompareOrdinal.
c = string.CompareOrdinal(b, a);
// Part 3: use CompareTo.
c = a.CompareTo(b);
c = b.CompareTo(a);
Console.WriteLine(c);-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.