C # stitching string strings

Day 16 day one case 2020-03-26

   1) using the "+" character string string splicing

string str = string.Empty;
str = "a";
str = str + "b";
str = str + "c";
str = str + "d";
str = str + "e";
Console.WriteLine(str);
Console.ReadKey();

 

2) the object using the string concatenation stringbuilder

StringBuilder sb = new StringBuilder();
sb.Append("a");
sb.Append("b");
sb.Append("c");
sb.Append("d");
sb.Append("e");
sb.Append("f");
Console.WriteLine(sb);
Console.ReadKey();

Guess you like

Origin www.cnblogs.com/ljs7490/p/12577753.html