textBox1.Text.Insert(…) method doesn't work

后端 未结 2 1201
太阳男子
太阳男子 2021-01-22 12:26

I\'m facing this abnormal situation. The following code doesn\'t work properly:

        string temp = \"heythere\";
        Console.WriteLine(temp);
        temp         


        
2条回答
  •  不知归路
    2021-01-22 13:23

    Strings are immutable, they don't change in-place. Try:

    string temp = "heythere";
    Console.WriteLine(temp);
    temp = temp.Insert(3, "hello");
    Console.WriteLine(temp);
    

提交回复
热议问题