using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 3;i++ )
{
ThreadStart starter = delegate { ttt(i); };
Thread threadDown = new Thread(new ThreadStart(starter));
threadDown.IsBackground = true;
threadDown.Start(); }
Console.ReadLine();
} static void ttt(int i)
{
//Console.WriteLine(AppDomain.GetCurrentThreadId().ToString()); Console.WriteLine(i.ToString());
}
}
}
实际运行结果为2
2
3
这是为什么呀!谢谢
using System.Collections.Generic;
using System.Text;
using System.Threading;namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 3;i++ )
{
ThreadStart starter = delegate { ttt(i); };
Thread threadDown = new Thread(new ThreadStart(starter));
threadDown.IsBackground = true;
threadDown.Start(); }
Console.ReadLine();
} static void ttt(int i)
{
//Console.WriteLine(AppDomain.GetCurrentThreadId().ToString()); Console.WriteLine(i.ToString());
}
}
}
实际运行结果为2
2
3
这是为什么呀!谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货