码迷,mamicode.com
首页 > Windows程序 > 详细

C#计算某一些任务的执行时间(消耗时间)

时间:2014-10-23 16:11:19      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   ar   for   sp   div   on   

 class Program
    {
        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();
        }
    }

 

C#计算某一些任务的执行时间(消耗时间)

标签:style   blog   color   os   ar   for   sp   div   on   

原文地址:http://www.cnblogs.com/allen0118/p/4045705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!