您将看到这个匿名方法的细节。
使用匿名方法不可取的。网络本身?
编辑匿名方法或任何包含匿名方法的方法。
Editing an anonymous method or any method that contains an anonymous method.
使委托与匿名方法关联。
添加新的匿名方法。
仅当匿名方法可能被用于任何委托时省略括号。
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.
这些操作都可以接受一个委托,一般可以使用匿名方法的方式来传递。
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 anonymous delegate declaration.
通过将委托与命名方法或匿名方法关联,可以实例化委托。
A delegate can be instantiated by associating it either with a named or anonymous method.
如下面的例子所示,一个匿名方法可以接受任何类型的参数。
As shown in the following example, an anonymous method can accept arguments of any type.
要将代码块传递为委托参数,创建匿名方法则是唯一的方法。
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.
这些操作都可以接受一个委托,一般可以使用匿名方法的方式来传递。
These all accept a delegate , usually in the form of an anonymous method.
最大的消息是调试器现在支持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."
这些方法的实现被包含在匿名的类中,在遇到方法时这些类就会被生成。
The implementations for those methods are contained in anonymously named classes that are generated when the method is encountered.
应用推荐