Stopwatch sw = new Stopwatch(); sw.Start();
//需要计算执行时间代码 sw.Stop(); TimeSpan ts2 = sw.Elapsed; Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds);
Stopwatch sw = new Stopwatch(); sw.Start();
//需要计算执行时间代码 sw.Stop(); TimeSpan ts2 = sw.Elapsed; Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds);