What is the difference between a == b
and a.Equals(b)
?
== checks if references are pointing to the same object in the memory
Now,
although the code of equals method in object class is nothing but checking == for the references, it can be overridden to add your own equality checks.
In classes like String, the overridden method checks if the string literals are correct or not. So basically it can be used to check if value is same or not.