c# 计算语句执行时间

                Stopwatch sw = new Stopwatch(); 
                sw.Start();        
//需要计算执行时间代码 sw.Stop(); TimeSpan ts2 = sw.Elapsed; Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds);

 

posted @ 2022-05-11 20:06  流年sugar  阅读(83)  评论(0编辑  收藏  举报