Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("开始======");
            queue.ProcessItemFunction += A;
            queue.ProcessException    += C;

            ComInfo info = new ComInfo();

            for (int i = 1; i < 50; i++)
            {
                Task.Factory.StartNew((param) =>
                {
                    info       = new ComInfo();
                    info.ComId = int.Parse(param.ToString());
                    info.Date  = DateTime.Now.Date;
                    queue.Enqueue(info);
                }, i);
            }

            Console.WriteLine("结束======");

            Console.ReadKey();
        }
Beispiel #2
0
 static void A(ComInfo info)
 {
     Console.WriteLine(info.ComId + "====" + queue.Count);
 }