一: 

            DateTime BeginTime = System.DateTime.Now;
            //
代码
            DateTime EndTime = System.DateTime.Now;
            TimeSpan ts = EndTime.Subtract(BeginTime);
            MessageBox.Show(ts.TotalMilliseconds.ToString());

   

二:

            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            watch.Reset();
            watch.Start();
            //
代码
            watch.Stop();
            MessageBox.Show(watch.ElapsedMilliseconds.ToString());

相关文章:

  • 2022-01-04
  • 2021-12-05
  • 2021-07-29
  • 2021-06-06
  • 2021-04-18
  • 2021-11-08
  • 2021-06-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-01-09
  • 2021-12-15
  • 2021-12-19
  • 2021-04-01
相关资源
相似解决方案