计算运行代码的时间

        Stopwatch sw;
        sw = new Stopwatch();
        sw.Start();
    //待计算运行时间的代码 sw.Stop(); TimeSpan ts2
= sw.Elapsed; MessageBox.Show(ts2.TotalMilliseconds.ToString());

 

posted @ 2020-06-05 11:52  帝雪寒天  阅读(226)  评论(0编辑  收藏  举报