c# 计时器

using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cs_frist
{
    class Program
    {
        static void Main(string[] args)
        {
            Stopwatch click = new Stopwatch();
            click.Start();

            //string str = string.Empty;
            //for(int i = 0;i < 10000; i++)
            //{
            //    str += i.ToString();
            //}

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < 10000; i++)
            {
                sb.Append(i.ToString());
            }

            click.Stop();
            Console.WriteLine(click.ElapsedMilliseconds);
        }
    }
}

 

posted @ 2020-09-10 20:08  Arrokoth  阅读(131)  评论(0)    收藏  举报