1.词汇
- delegate instance 委托实例
- Static Method 静态方法
- Instance Method 实例方法
2.例句
-
Now that you have a delegate type and a method with the right signature, you can create an instance of that delegate type,specifying that this method be executed when the delegate instance is invoked.
现在我们已经有了一个委托类型和一个正确的签名方法,那么我们可以接着创建一个委托实例了,并指定委托实例被调用时,要执行的方法。
-
The exact form of the expression used to create the delegate instance depends on whether the action uses an instance method or a static method. Suppose PrintString is a static method in a type called StaticMethods and an instance method in a type called InstanceMethods.
至于具体用什么形式来创建委托实例,这取决于方法是实例方法还是静态方法。假设PrintString是一个StaticMethods类的静态方法,在InstanceMethods类型中是一个实例方法.
3.代码
StringProcessor proc1, proc2;
proc1 = new StringProcessor(StaticMethods.PrintString);
InstanceMethods instance = new InstanceMethods();
proc2 = new StringProcessor(instance.PrintString);