C#拼接string字符串
1)使用'+'拼接string字符串
string str = string.Empty;
str = 'a';
str = str + 'b';
str = str + 'c';
str = str + 'd';
str = str + 'e';
Console.WriteLine(str);
Console.ReadKey();
2)使用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();
赞 (0)