各位代表,Lambda表达式,动作,Func键,匿名函数 [英] Delegates, Lambdas, Action, Func, Anonymous Functions

查看:142
本文介绍了各位代表,Lambda表达式,动作,Func键,匿名函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想验证我的理解有关以下

I just want to verify my understanding about the following


  • 代表 - 一个方法签名

  • Lambda表达式 - 匿名函数

  • 匿名函数 - 只是

  • 动作 - 返回的东西的匿名函数
  • $ b - 不返回任何内容
  • 函数功能匿名函数$ b
  • Delegate - a method signature
  • Lambdas - anonymous function
  • Anonymous Function - just that
  • Action - An anonymous function that returns nothing
  • Func - An anonymous function that returns something

嗯......他们都做类似的事情,你怎么定义与放大器;知道何时使用的呢?

hmm... they all do similar things, how do you define & know when to use each?

对不起,我不解释好

推荐答案


  • 代表 - 它不是一个方法签名。 这是封装的方法的类型。因此,一个委托声明应该有类似就是了封装方法的签名。 何时使用委托 - 每当你想一个方法传递给另一个函数有关更多见的this 并的这个

  • Delegate - it is not a method signature. It is a type which encapsulates a method. Hence a delegate declaration should have a signature similar to the method it wants to encapsulate. When to use Delegate - whenever you want to pass a method to another function. For more see this and this.

    Lambda表达式 - 手短,写的匿名函数更有表现力的方式。但是,还有更多给它。 lambda表达式也可以转换为表达式树。欲了解更多请参见这个

    Lambdas - short hand and more expressive way of writing an anonymous function. But there is more to it. A lambda expression can also be converted to an expression tree. For more see this.

    匿名函数 - 是的..只是

    Anonymous Function - yes .. just that

    动作 - 这是一个委托可以封装不返回任何内容的功能。所以,你应该把它看成 A类型,可以封装一个动作键,当你需要通过周围的行动中使用它。

    Action - It is a delegate which can encapsulate a function that returns nothing. So you should think of it as a type that can encapsulate an action and use it when you need to pass an action around.

    函数功能 - 可以封装返回的东西函数的委托。但是,你应该把它看作一个类型,可以封装转换键,当你想绕过转换使用。

    Func - A delegate that can encapsulate a function that returns something. But you should look at it as a type that can encapsulate a transformation and use when you want to pass around a transformation.

    这篇关于各位代表,Lambda表达式,动作,Func键,匿名函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆