Stopwatch进行程式性能监测

             Stopwatch类的命名空间:using System.Diagnostics; 

              用法:

              Stopwatch sw = new Stopwatch();
                sw.Start(); 

                //////////////////////////////////

               需要监测的代码

                /////////////////////////////////
                sw.Stop();
                TimeSpan ts2 = sw.Elapsed;
                ShowExclamation("执行时间" + ts2.TotalMilliseconds);//此处ShowExclamation方法是show包装后。

posted @ 2020-05-06 21:07  Loving伊  阅读(139)  评论(0)    收藏  举报