精确到毫秒,代码如下
'1.csv大小为23.6MB
Dim t1 As Date = Now
Dim tmp() = System.IO.File.ReadAllLines("d:\1.csv")
Dim t2 As Date = Now
Debug.Print("用时:" & (t2 - t1).TotalMilliseconds)
输出结果如下图

另一种方式是用Stopwatch来记录间隔时间:VB.NET用性能测试之用Stopwatch来记录间隔时间(操作耗时)-桔子雨工作室
© 版权声明
文章版权归作者所有,未经允许请勿转载。