计时器C# 用于测某一方法执行所用的时间: Stopwatch sw = new Stopwatch(); sw.Start(); //功能代码块 sw.Stop(); long totalTime = sw.ElapsedMilliseconds;