namespace ConsoleApplication1
{
class Program
{
static Task ones;
static void Main(string[] args)
{
ones = new Task(one);
ones.Start();
Console.ReadKey();
}
static void one()
{
Console.WriteLine("任务ID: {0}",Task.CurrentId);
var twos = new Task(two);
twos.Start();
Console.WriteLine("任务一启动");
Thread.Sleep(2000);
}
static void two()
{
Console.WriteLine("任务二启动");
Thread.Sleep(2000);
ones= new Task(one);
ones.Start();
}
}
}
{
class Program
{
static Task ones;
static void Main(string[] args)
{
ones = new Task(one);
ones.Start();
Console.ReadKey();
}
static void one()
{
Console.WriteLine("任务ID: {0}",Task.CurrentId);
var twos = new Task(two);
twos.Start();
Console.WriteLine("任务一启动");
Thread.Sleep(2000);
}
static void two()
{
Console.WriteLine("任务二启动");
Thread.Sleep(2000);
ones= new Task(one);
ones.Start();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货