String interning?
The second ReferenceEquals call returns false. Why isn't the string in s4 interned? (I don't care about the advantages of StringBuilder over string concatenation.) string s1 = "tom"; string s2 = "tom"; Console.Write(object.ReferenceEquals(s2, s1)); //true string s3 = "tom"; string s4 = "to"; s4 += "m"; Console.Write(object.ReferenceEquals(s3, s4)); //false When I do String.Intern(s4); , I still get false. Here, both s3 and s4 are interned but their references are not equal? string s3 = "tom"; string s4 = "to"; s4 += "m"; String.Intern(s4); Console.WriteLine(s3 == s4); //true Console.WriteLine