Example #1
0
 public static void OnConsume(ActionWrapper[] actions)
 {
     foreach (var item in actions)
     {
         item.DoAction(item.Parameter);
     }
 }
Example #2
0
        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();
        }