I know what string interning is, and why the following code behaves the way it does:
var hello = "Hello";
var he_llo = "He" + "llo";
var b = ReferenceEquals(hello, he_llo); //true
Or
var hello = "Hello";
var h_e_l_l_o = new string(new char[] { 'H', 'e', 'l', 'l', 'o' });
var b = ReferenceEquals(hello, he_llo); //false
...or I thought I did, because a subtle bug has cropped up in some code I'm working on due to this:
var s = "";
var sss = new string(new char[] { });
var b = ReferenceEquals(s, sss); //True!?
How does the compiler know that sss
will in fact be an empty string?