string.Replace (or other string modification) not working

前端 未结 4 586
误落风尘
误落风尘 2020-11-22 06:17

For the following code, I can\'t get the string.Replace to work:

someTestString.Replace(someID.ToString(), sessionID);

when I

4条回答
  •  半阙折子戏
    2020-11-22 07:08

    strings are immutable, the replace will return a new string so you need something like

    string newstring = someTestString.Replace(someID.ToString(), sessionID);
    

提交回复
热议问题