常用类库StringBuilder

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);

 

posted @ 2015-08-02 13:29  Bronc_Li  阅读(186)  评论(0编辑  收藏  举报