第一個是使用方法形式的實例方法:
incrementer.CountedADozen += IncrementDozensCount; //方法引用形式
第二個是使用方法形式的靜態方法:
incrementer.CountedAdozen += ClassB.CounterHandlerB; //方法引用形式
第三個是使用委托形式的實例方法:
mc.CountedADozen += new EventHandler(cc.CountHandlerC); //委托形式
使用匿名方法
incrementer.CountedADozen += delegate{DozensCount++;};
使用Lambda表達式
incrementer.CountedAdozen += () => DozensCount ++;