//启用计时器(引入命名空间using System.Diagnostics;) Stopwatch watch = new Stopwatch(); watch.Start(); ///要计时的运行程序 watch.Stop;