c# 如何显示2个数字之间停顿0.1秒
来源:百度知道 编辑:UC知道 时间:2024/05/18 05:27:20
怎么写程序~~
不用线程的那种办法能不能仔细说说
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
namespace ConsoleApplication3
{
class Program
{
static string astr = "abcd";
static string bstr = "efgh";
static void Main(string[] args)
{
Timer ti = new Timer();
ti.Enabled = true;
ti.Interval = 100;
Console.WriteLine(astr);
ti.Elapsed += new ElapsedEventHandler(ti_Elapsed);
ti.Start();
Console.Read();
}
static void ti_Elapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine("bstr");
}
}
}
Console.WriteLine("abcd");
System.Threading.Thread.Sleep(1000);
Console.WriteLine("efgh&quo