仅当匿名方法可能被用于任何委托时省略括号。
Omit the parenthesis only if the anonymous method could have been used on any delegate.
更改具有由匿名方法初始化的字段的构造函数。
Changing a constructor with a field that is initialized by an anonymous method.
这意味着匿名方法可转换为具有各种签名的委托。
This means that an anonymous method can be converted to delegates with a variety of signatures.
匿名方法通常用于将代码块作为委托参数进行传递。
Anonymous methods are most frequently used to pass a code block as a delegate parameter.
匿名方法模仿普通方法的布局,和匿名委托定义放在一行。
With anonymous methods mimic the code layout of a regular method, aligned with the anonymous delegate declaration.
通过将委托与命名方法或匿名方法关联,可以实例化委托。
A delegate can be instantiated by associating it either with a named or anonymous method.
要将代码块传递为委托参数,创建匿名方法则是唯一的方法。
Creating anonymous methods is essentially a way to pass a code block as a delegate parameter.
为了与匿名方法一起使用,委托和与之关联的代码必须一起声明。
For use with anonymous methods, the delegate and the code to be associated with it are declared together.
当匿名方法使用局部变量的值时,将在执行匿名方法时获取该值。
When an anonymous method USES the value of a local variable, the value is obtained at the moment the anonymous method is executed.
本主题说明程式码分析如何处理与匿名方法相关联的警告和度量资讯。
This topic explains how Code Analysis handles warnings and metrics that are associated with anonymous methods.
最大的消息是调试器现在支持C# 2.0的特性,如泛型、匿名方法和迭代器……
The biggest news is that the debugger now has support for C# 2.0 features such as generics, anonymous methods and iterators ....
将匿名方法提取到其他方法中时,将在调用提取方法时获取局部变量的值。
When an anonymous method is extracted into another method, the value of the local variable is obtained at the moment of the call to the extracted method.
委派物件一般是借由提供委派将包装的方法名称来建构,或使用匿名方法建构。
A delegate object is normally constructed by providing the name of the method the delegate will wrap, or with an anonymous method.
没有参数的匿名方法加上空的圆括号。除非这个匿名方法可能被用到任何类型的委托上。
Use empty parentheses on parameter-less anonymous methods. Omit the parentheses only if the anonymous method could have been used on any delegate.
可以在需要委托值的任何地方(也就是在可以使用匿名方法的任何地方)使用这些表达式。
You can use them anywhere a delegate value is expected, that is, wherever an anonymous method can be used.
通过使用匿名方法,由于您不必创建单独的方法,因此减少了实例化委托所需的编码系统开销。
By using anonymous methods, you reduce the coding overhead in instantiating delegates because you do not have to create a separate 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).
方法接收一个新的客户端对象,以及一个匿名方法,该方法持有的代码与正常使用using语句块包含的代码完全相同。
This method takes a new client object and an anonymous method that holds the same code a normal using block would contain.
任何大 量使用了匿名方法的项目,在升级到VisualStudio 2008时,有可能无法保持代码分析的清洁性。
The bad news is that any project making heavy use of anonymous methods is likely no longer Code Analysis clean on its upgrade to Visual Studio 2008.
若要在这种情况下取消订阅,必须回到订阅该事件的程序码,并将此匿名方法储存到委派变数内,然后再将该委派加入此事件中。
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.
他们引用了一位匿名研究人员的话,说得很精辟:“使用糟糕的方法也能得到结果。”
They quote an anonymous researcher who said pithily: "Poor methods get results."
此代码还举例说明了指定回调的参数的一种方法:作为一个匿名列表,具有到作为第一个参数的回调的引用,随后是所需的参数。
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.
会话还提供一种跟踪匿名用户或那些在漫游站点之前不必首先登录的用户的方法。
Sessions also provide a way to track anonymous users, or those who aren't required to log in first before roaming through a site.
这些方法的实现被包含在匿名的类中,在遇到方法时这些类就会被生成。
The implementations for those methods are contained in anonymously named classes that are generated when the method is encountered.
不再有丑陋的匿名内部类:只要通过这些便捷方法使用闭包就可以!
No more ugly anonymous inner classes: just use closures through those shortcut methods!
他们需要一个有效并且可靠的方法来从一些嫌疑人中确定谁写了那些匿名邮件。
They need a reliable, effective way to determine which of several suspects has written the emails under investigation.
如果有两个匿名成员都提供一个方法,编译器将会报错,但只在该方法被调用的情况下。
If there are two anonymous members that both provide a method, the compiler will produce an error, but only if that method is called.
当每次调用匿名类的父方法时都必须创建一个该类实例。
An instance of this class has to be created for each time the parent method is called.
为了在递归方法中传递,匿名类应该扩展方法已知的包装器类型。
To pass this to a recursive method, the anonymous class should extend a wrapper type known to the method.
它的作用在于,您可以使用匿名类来替代您所希望替代的方法;剩下的方法会按默认方式实现。
What's useful about this class is that you can use anonymous classes to override only the methods you want; the rest of the methods are implemented by default.
应用推荐