I know it returns integer but I needed to know on what basis.
Example:
string s1 = "world";
string s2 = "World";
Console.WriteLine(string.Compare(s1,s2));
Console.WriteLine(s1.CompareTo(s2));
it returns -1 for both. But if we capitalize w in s1 and lowercase w in s2 it returns 1.
So need some explanation for it.
We can see the difference when one (or both strings) is
null: