I have the Following Code
CASE 1
string string1 = "pankaj";
string string2 = "pankaj";
Console.WriteLine(string1 == string2); // output TRUE
CASE 2
object obj1 = "pankaj";
object obj2 = "pankaj";
Console.WriteLine(obj1==obj2); // Output TRUE
CASE 3
object againObject1 = 2;
object againObject2 = 2;
Console.WriteLine(againObject1==againObject2); // Output FALSE
as string and object are both reference type and for reference type I learned that equality operation checks if they hold the same address, in above two case why its comparing value instead of references.
what is more confusing is the behavior of equality operator for object type in case 2 and case 3 for string type it computes true and for integers its return false.