It looks like you're just trying to smooth out the first character of a string
value. If so, then your code will be fine, but you need to assign a new line to the sentence
value.
sentence = char.ToUpper(sentence[0]) + sentence.Substring(1)
A string
in .Net is immutable, and so every operation that changes the value of string
produces a new value. It will not change the original meaning in place. Therefore, to see the result of a change, you must assign it to a variable.
source share