string x = "alok b";
string y = "alok b";
string z = "alok";
//y += x.Replace(y, string.Empty);
z += " b";
Console.WriteLine(object.ReferenceEquals(x,y));
Console.WriteLine(object.ReferenceEquals(y, z));
How is first line is printing true
and second false
?
and changing to below statement is printing true
.
Console.WriteLine(object.ReferenceEquals(y,string.Intern(z)));