日期:2014-05-17 浏览次数:20869 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
class Program
{
static void Main(string[] args)
{
List<Action> actions = new List<Action>();
actions.Add(() => Console.WriteLine("A1"));
actions.Add(() => Console.WriteLine("A2"));
actions.Add(() => Console.WriteLine("A3"));
actions.Add(() => Console.WriteLine("A4"));
foreach (var action in actions)
{
ThreadPool.QueueUserWorkItem(state => action(), null);
Thread.Sleep(1);
}
Console.Read();
}
}
ThreadPool.QueueUserWorkItem(state => action(), null);
state => action()