在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
static void SubTest() { DateTime beforDT = System.DateTime.Now; //耗时巨大的代码 DateTime afterDT = System.DateTime.Now; TimeSpan ts = afterDT.Subtract(beforDT); Console.WriteLine("DateTime总共花费{0}ms.", ts.TotalMilliseconds); } static void SubTest() { Stopwatch sw = new Stopwatch(); sw.Start(); //耗时巨大的代码 sw.Stop(); TimeSpan ts2 = sw.Elapsed; Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论