class Program
{
static void Main(string[] args)
{
Program obj = new Program();
obj.DisplayThread();
Console.ReadLine();
}
public void DisplayThread()
{
Thread thread1 = new Thread(Thread1);
Thread thread2 = new Thread(Thread2);
thread1.Start();
thread2.Start();
}
public void Thread1()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine("我是线程一:"+i);
if (i>30)
{
Thread.CurrentThread.Abort();
}
}
}//Thread1_End;
public void Thread2()
{
for (int i = 0; i < 2; i++)
{
string str = " 你好 ,请休息下崽继续玩游戏";
foreach (char item in str)
{
Console.Write(item);
Thread.Sleep(500);
}
}
}
}
转载于:https://www.cnblogs.com/fftan/p/5133371.html