What I want to do: create a function that takes a string and a single char as input. The function then shall "flip" every char according to the input char to a lower or upper case char.
My Problem: I want to do this with a ref string input, therefore the string gets changed in the function directly without the need to create a new string in the function.
Here is the simplified code:
static void Flip(ref string input)
{
input[0] = 'a';
}
The Problem: Error message -> Property cannot be assigned to, it is read only.
My Question - how can I change that?
What I COULD do is: input = "whatever", but if I want to index through the different letters in the string with input[i] and change those, it's not possible!
Since I'm new to the "ref" subject - why is this, and how do I fix it?
Thanks!