C# 使用 Stopwatch 测量代码运行时间
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
System.Threading.Thread.Sleep(3000);
sw.Stop();
Console.WriteLine(sw.Elapsed);
sw.Start();
System.Threading.Thread.Sleep(3000);
sw.Stop();
Console.WriteLine(sw.Elapsed);
浙公网安备 33010602011771号