1 string a = string.Empty; 2 Stopwatch sp = new Stopwatch();//using System.Diagnostics; 3 sp.Start();//开始 4 for (int i = 0; i < 100000; i++) 5 { 6 a += i; 7 } 8 sp.Stop();//结束 9 Console.WriteLine(sp.Elapsed);//sp.Elapsed为时间间隔
原文:http://www.cnblogs.com/wwz-wwz/p/6388029.html