C# replace string in string

后端 未结 7 1218
情歌与酒
情歌与酒 2020-12-09 10:57

Is it possible to replace a substring in a string without assigning a return value?

I have a string:

string test = "Hello [REPLACE] world";
<         


        
7条回答
  •  隐瞒了意图╮
    2020-12-09 11:20

    You can't, as in C# strings are immutable. Something like this would violate that.

    You need to have the return type of string, because the one you're working with cannot change.

提交回复
热议问题