what's the use of string.Clone()?

后端 未结 3 877
情话喂你
情话喂你 2020-12-01 20:28

there are 2 examples of code: # 1

 string str1 = \"hello\";
 string str2 = str1; //reference to the same string
 str1 = \"bye\"; //new string created
         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-01 21:33

    Not directly in answer to your question, but in case you are looking to actually clone a string, you can use the static string.Copy() method.

提交回复
热议问题