I was trying to better understand string's interning in c# and got into the following situation:
string a ="Hello";
string b ="Hello";
string c = new string(new char[]{'H','e','l','l','o'});
string d = String.Intern(c);
Console.WriteLine(a==b);
Console.WriteLine(c==d);
Console.WriteLine((object)a==(object)b);
Console.WriteLine((object)c==(object)d);
I'm getting the following result in console:
True
True
True
False
The mistake for me is that why is the 4th false ?