I want to do this:
string s = \"abc\";
s[1] = \'x\';
and s will become \"axc\". However, it seems that string[i] only has a getter and has
I don't think you can do this in C#, as the string cannot be altered (just destroyed and recreated). Have a look at the StringBuilder class.
Strings are immutable, so you have to make a char[]
array, change it, then make it back into a string:
string s = "foo";
char[] arr = s.ToCharArray();
arr[1] = 'x';
s = new string(arr);