C# 计时程序运行时间
2021-05-17 23:30
标签:second before stopwatch var dia get red start sys 第一种 System.DateTime 第二种用Stopwatch类(System.Diagnostics) 转自:https://www.cnblogs.com/I-am-Betty/p/10489787.html C# 计时程序运行时间 标签:second before stopwatch var dia get red start sys 原文地址:https://www.cnblogs.com/xuqp/p/11756736.htmlpublic static void SubTest()
{
DateTime beforeDT = System.DateTime.Now;
int[] a = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
//Shuffle(a) is the function you want to test.
Shuffle(a);
DateTime afterDT = System.DateTime.Now;
TimeSpan ts = afterDT.Subtract(beforeDT);
Console.WriteLine("DateTime costed for Shuffle function is: {0}ms",ts.TotalMilliseconds);
}
///
下一篇:SAC#1 - 组合数