public static void OnConsume(ActionWrapper[] actions) { foreach (var item in actions) { item.DoAction(item.Parameter); } }
static void Main() { ProducerConsumer<ActionWrapper> pc = new ProducerConsumer<ActionWrapper>(1, 10000, 1000, 5, 1, 5000); pc.OnConsume += OnConsume; for (int i = 0; i < 100; i++) { ActionWrapper wrapper = new ActionWrapper(); wrapper.Parameter = i.ToString(); wrapper.DoAction = GetAction(); pc.Produce(wrapper); } Console.ReadLine(); }