C# 简单测试代码运行时间
//测算运行时间
Stopwatch st = new Stopwatch();
st.Restart(); // 停止时间间隔测量,将运行时间重置为零,然后开始测量运行时间
for (int i = 0; i < 100000000; i++)
{
//System.Threading.Thread.Sleep(100);
}
MessageBox.Show(st.ElapsedMilliseconds.ToString()); //用时222毫秒
Author: HK
Date : 2021-09-16-21:00
Address:SZ