C# 测试代码段性能耗时

 一: 

            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());

上一篇:hdu 4612 (双联通+树形DP)


下一篇:Mysql多表表关联查询 inner Join left join right join