I know that \"string\" in C# is a reference type. This is on MSDN. However, this code doesn\'t work as it should then:
class Test
{
public static void
"A picture is worth a thousand words".
I have a simple example here, it's similar to your case.
string s1 = "abc";
string s2 = s1;
s1 = "def";
Console.WriteLine(s2);
// Output: abc
This is what happened:
s1 and s2 variables reference to the same "abc" string object."abc" string object do not modify itself (to "def"), but a new "def" string object is created instead, and then s1 references to it.s2 still references to "abc" string object, so that's the output.