Hi Everyone!
I'm learning C# and just practicing a bit of coding and getting a bit stuck..
So I've got this function (I've cut out the unnecessary bits..):
When I try to compile it I get an error saying "Property or indexer 'string.this[int]' cannot be assigned to -- it is read only.
Basically I need to create a new string which is a copy of the original then change some of the characters (to a number between 0 and 9) and it's a recursive function.
I can't figure out how to get rid of the error
Thanks in advance!
I'm learning C# and just practicing a bit of coding and getting a bit stuck..
So I've got this function (I've cut out the unnecessary bits..):
C#:
public static string solved(string puzzle) {
firstChar = 'a';
....
for (int i = 0; i < 10; i++) {
string newPuz = string.Copy(puzzle);
for (int j = 0; j < newPuz.Length; j++) {
if (newPuz[j] == firstChar) {
newPuz[j] = (char)i;
}
}
.....
string newAnz = solved(newPuz);
}
}
When I try to compile it I get an error saying "Property or indexer 'string.this[int]' cannot be assigned to -- it is read only.
Basically I need to create a new string which is a copy of the original then change some of the characters (to a number between 0 and 9) and it's a recursive function.
I can't figure out how to get rid of the error
Thanks in advance!