1.使用StringBuilder拼接字符串实例:
string[] lines
=
File.ReadAllLines("sdjk.txt", Encoding.Default);
????????//创建监视对象
Stopwatch
watch
=
new
Stopwatch();
StringBuilder
str
=
new
StringBuilder();
//监视开始
watch.Start();
for (int
i
=
0; i
<
lines.Length; i++)
{
str.Append(lines[i]);
}
//监视结束
watch.Stop();
//显示监视时间
Console.WriteLine(watch.Elapsed);
?
时间: 2024-11-29 09:14:16