示例#1
0
        static void Main(string[] args)
        {
            PublisherIncrementer incrementer = new PublisherIncrementer();
            var dozen = new SubscriberDozens(incrementer);

            incrementer.DoCount();
            Console.WriteLine("计数:{0}", dozen.DozensCount);
        }
示例#2
0
 public SubscriberDozens(PublisherIncrementer incrementer)
 {
     DozensCount = 0;
     //incrementer.CountedADozen +=new Handler(IncrementDozensCount);   //订阅事件
     incrementer.CountedADozen += IncrementDozensCount;
 }