What is the difference between lambdas and delegates in the .NET Framework?

后端 未结 17 1370
小蘑菇
小蘑菇 2020-12-12 10:45

I get asked this question a lot and I thought I\'d solicit some input on how to best describe the difference.

17条回答
  •  情歌与酒
    2020-12-12 10:56

    Well, the really oversimplified version is that a lambda is just shorthand for an anonymous function. A delegate can do a lot more than just anonymous functions: things like events, asynchronous calls, and multiple method chains.

提交回复
热议问题