CompareTo method is comparing instance of object with parameter of String object.
Equals method determine the value of both are the same or not.
CompareTo should be used when you are comparing two objects' values.
String str1 = "abc";
String str2 = "def"
if(strq.CompareTo(str2) //
Equals should be used when either one or both are not objects.
string str1 = "abc";
if(str1.Equals("abc") //
If you use CompareTo method for normal value type variables, it will use type cast (boxing) which is not necessary.