C# 增加时间的三个方法

Posted bedfly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C# 增加时间的三个方法相关的知识,希望对你有一定的参考价值。

第一个是使用方法形式的实例方法:

incrementer.CountedADozen += IncrementDozensCount;  //方法引用形式

 

第二个是使用方法形式的静态方法:

incrementer.CountedAdozen += ClassB.CounterHandlerB;   //方法引用形式

 

第三个是使用委托形式的实例方法:

mc.CountedADozen += new EventHandler(cc.CountHandlerC);   //委托形式

使用匿名方法

incrementer.CountedADozen += delegate{DozensCount++;};

使用Lambda表达式

incrementer.CountedAdozen += () => DozensCount ++;

以上是关于C# 增加时间的三个方法的主要内容,如果未能解决你的问题,请参考以下文章