C#中倒计时

 static void Main(string[] args)
        {
          

            DateTime dt = DateTime.Now;
            while (true)
            {
                DateTime dt2 = DateTime.Now;
                TimeSpan ts = dt2 - dt;
                if (ts.Seconds <= 60)
                {
                    Console.Clear();
                    Console.Write(60 - ts.Seconds);
                    Thread.Sleep(100);
                }
                else
                {
                    break;
                }
            }
        }

posted on 2018-03-08 21:48  连一粝  阅读(1054)  评论(0编辑  收藏  举报

导航