With anonymous methods mimic the code layout of a regular method, aligned with the anonymous delegate declaration.
匿名方法模仿普通方法的布局,和匿名委托定义放在一行。
These all accept a delegate, usually in the form of an anonymous method.
这些操作都可以接受一个委托,一般可以使用匿名方法的方式来传递。
An anonymous function is defined within the context of another function, usually by assigning it to a delegate variable.
匿名函数通常通过分配到一个代理变量,来在其他函数的上下文中定义。
Use empty parentheses on parameter-less anonymous methods. Omit the parentheses only if the anonymous method could have been used on any delegate.
没有参数的匿名方法加上空的圆括号。除非这个匿名方法可能被用到任何类型的委托上。
These are classes that execute user code, often a delegate to some method (which might be anonymous), when certain conditions are met.
这些类用来在当特定情况出现时执行用户代码(用户代码通常是某个方法的delegate)。
A delegate can be instantiated by associating it either with a named or anonymous method.
通过将委托与命名方法或匿名方法关联,可以实例化委托。
Anonymous methods are most frequently used to pass a code block as a delegate parameter.
匿名方法通常用于将代码块作为委托参数进行传递。
Omit the parenthesis only if the anonymous method could have been used on any delegate.
仅当匿名方法可能被用于任何委托时省略括号。
For use with anonymous methods, the delegate and the code to be associated with it are declared together.
为了与匿名方法一起使用,委托和与之关联的代码必须一起声明。
Creating anonymous methods is essentially a way to pass a code block as a delegate parameter.
要将代码块传递为委托参数,创建匿名方法则是唯一的方法。
To unsubscribe in this scenario, it is necessary to go back to the code where you subscribe to the event, store the anonymous method in a delegate variable, and then add the delegate to the event.
若要在这种情况下取消订阅,必须回到订阅该事件的程序码,并将此匿名方法储存到委派变数内,然后再将该委派加入此事件中。
These all accept a delegate , usually in the form of an anonymous method.
这些操作都可以接受一个委托,一般可以使用匿名方法的方式来传递。
With anonymous methods, mimic the code layout of a regular method, aligned with the delegate declaration. (complies with placing an open curly brace in a new line).
使用匿名方法时,代码风格应该和普通方法一样,与委托声明对齐。(大括号应该放到新的一行里)。
Associating the delegate with an anonymous method.
使委托与匿名方法关联。
You can use them anywhere a delegate value is expected, that is, wherever an anonymous method can be used.
可以在需要委托值的任何地方(也就是在可以使用匿名方法的任何地方)使用这些表达式。
A delegate object is normally constructed by providing the name of the method the delegate will wrap, or with an anonymous method.
委派物件一般是借由提供委派将包装的方法名称来建构,或使用匿名方法建构。
A delegate object is normally constructed by providing the name of the method the delegate will wrap, or with an anonymous method.
委派物件一般是借由提供委派将包装的方法名称来建构,或使用匿名方法建构。
应用推荐