Now, to me, strings have always been value types. Learning that they're not, and are in fact what's called Immutable String is very interesting, but holds a very important question:
When would a string not be an immutable string?
See, when I declare a string like this:
string testString = "abc";
The stack should now hold the variable declaration and the heap the value, to which the variable is referencing. If I declared a second string:
string secondString = testString;
Both variables should now reference the same position on the heap. If I did this:
secondString = testString + "def";
The value on the heap should be copied, modified and a second value should lie on the heap.
I understand this is what an immutable string is.
But since this is pretty much how I've always been declaring and working with strings, I wonder if there is another way, a mutable string, so to say.