C# 计算某一些任务的执行时间

 static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            for (int i = 0; i < 50000000; i++)
            {
                //Code
            }
            sw.Stop();

            Console.WriteLine("Total:" + sw.ElapsedMilliseconds + "ms");
            Console.ReadLine();
        }

猜你喜欢

转载自blog.csdn.net/chenpeng0118/article/details/40396199
今日推荐