此代码还举例说明了指定回调的参数的一种方法:作为一个匿名列表,具有到作为第一个参数的回调的引用,随后是所需的参数。
This code also demonstrates one way to specify arguments to a callback: as an anonymous list, with a reference to the callback invoked as the first element, followed by the required parameters.
session参数可以为空,这表示该方法将创建一个单独的匿名会话,请创建该会话,然后在一次方法调用中保存它。
The session parameter can be null, meaning that the method will create a separate anonymous session, do the work and then save the session in one method call.
原先的行为:一个匿名继承调用可以通过调用父类中的任何方法接受参数兼容当前方法的参数。
Old behaviour: an anonymous inherited call could call through to any method in a parent class that accepted arguments compatible to the parameters of the current method.
没有参数的匿名方法加上空的圆括号。除非这个匿名方法可能被用到任何类型的委托上。
Use empty parentheses on parameter-less anonymous methods. Omit the parentheses only if the anonymous method could have been used on any delegate.
要将代码块传递为委托参数,创建匿名方法则是唯一的方法。
Creating anonymous methods is essentially a way to pass a code block as a delegate parameter.
匿名方法通常用于将代码块作为委托参数进行传递。
Anonymous methods are most frequently used to pass a code block as a delegate parameter.
您可使用匿名方法来忽略参数列表。
初始化匿名承载的动态方法,指定方法名称、返回类型和参数类型。
Initializes an anonymously hosted dynamic method, specifying the method name, return type, and parameter types.
初始化匿名承载的动态方法,指定方法名称、返回类型和参数类型。
Initializes an anonymously hosted dynamic method, specifying the method name, return type, and parameter types.
应用推荐