110,538
社区成员
发帖
与我相关
我的任务
分享
List<Action> actions = new List<Action>();
actions.Add(() => { Console.WriteLine("A-1"); });
actions.Add(() => { Console.WriteLine("A-2"); });
actions.Add(() => { Console.WriteLine("A-3"); });
actions.Add(() => { Console.WriteLine("A-4"); });
for (var i = 0; i < 10; i++)
{
foreach (var action in actions)
{
var tempAction = action;
ThreadPool.QueueUserWorkItem(state => tempAction(), null);
}
}