`
alovejun14
  • 浏览: 77683 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

线程基本使用

阅读更多

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("线程已开启:");
            Thread workerThread = new Thread(new ThreadStart(WorkerMethod));
            workerThread.Start();
        }

        static void WorkerMethod()
        {
            for (int i = 0; i < 20; i++)
            {
                Console.WriteLine("打印出的数字为:[{0}]",DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
                Thread.Sleep(60000);
            }
        }
    }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics