First, take a look at the signature of ToUpper()
and notice it returns a string. This doesn't modify the string you call it on; rather it returns a new string result from that operation.
In your case you have the phrases already. You can take the first character of a phrase with phrase[0]
or phrase.First()
. You should also take a look at Substring
which gives you a range of characters from a string.
Putting that all together you could do something like:
phrase = phrase[0].ToString().ToUpper() + phrase.Substring(1);
What this does is take the first character from phrase
and turn it from a char to a string which is what you need to call ToUpper()
which you then concatenate with the remainder of the phrase using Substring
starting at position 1 (which is the second character) and assign it back to phrase.