示例#1
0
        public void StartReactiveExtensionsQueue()
        {
            //Reactive Extension Queue
            var q = new RxQueuePubSub();

            q.RegisterHandler <JobA>(j => Console.WriteLine(Global.Counter));
            q.RegisterHandler <JobB>(j => Global.Counter++);
            q.Enqueue(new JobA()); //print
            q.Enqueue(new JobB()); //add
            q.Enqueue(new JobA()); //print
            q.Enqueue(new JobB()); //add
            q.Enqueue(new JobB()); //add
            q.Enqueue(new JobA()); //print
        }
        static void Main(string[] args)
        {
            var q = new RxQueuePubSub();

            //q.RegisterHandler<JobA>(j => Console.WriteLine(Global.Counter));
            //q.RegisterHandler<JobB>(j => Global.Counter++);

            //q.Enqueue(new JobA());//print
            //q.Enqueue(new JobB());//add
            //q.Enqueue(new JobA());//print
            //q.Enqueue(new JobB());//add
            //q.Enqueue(new JobB());//add
            //q.Enqueue(new JobA());//print
        }