Stopwatch类 using System.Diagnostics;

      static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            Thread.Sleep(2000);
            stopWatch.Stop();
            TimeSpan ts = stopWatch.Elapsed;
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                ts.Hours, ts.Minutes, ts.Seconds,
                ts.Milliseconds / 10);
            Console.WriteLine("RunTime " + elapsedTime);
            Console.ReadKey();
        }

C#程序执行时间

 

相关文章:

  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2021-09-17
  • 2021-12-21
  • 2021-08-05
  • 2022-03-15
  • 2021-12-08
猜你喜欢
  • 2021-12-24
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-12-31
相关资源
相似解决方案