各位代表,Lambda表达式,动作,Func键,匿名函数

各位代表,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.