Does string immutability work by statement, or by strings within a statement?
For example, I understand that the following code will allocate two strings on the heap.
string s = "hello ";
s += "world!";
"hello" will remain on the heap until garbage collected; and s now references "hello world!" on the heap. However, how many strings does the following line allocate on the heap...1 or 2? Also, is there a tool/way to verify the results?
string s = "goodbye " + "cruel world!";