how do I set a character at an index in a string in c#?

后端 未结 7 1259
生来不讨喜
生来不讨喜 2020-11-28 16:28
someString[someRandomIdx] = \'g\';

will give me an error.

How do I achieve the above?

7条回答
  •  时光取名叫无心
    2020-11-28 16:51

    Check out this article on how to modify string contents in C#. Strings are immutable so they must be converted into intermediate objects before they can be modified.

提交回复
热议问题