What do you think of multiline lambdas in VB 10

前端 未结 7 2989
抹茶落季
抹茶落季 2021-02-20 03:09

I was just watching a video on MSDN Channel 9 which can be found here, about some of the new features in Visual Basic 10. Now I like most of the new features, some of which hav

7条回答
  •  青春惊慌失措
    2021-02-20 03:59

    By preference I'm a C# developer, but have been using VB 9 almost exclusively for about a year now. The #1 thing about VB 9 that breaks my heart is the limited lambdas. Lambdas in VB 9 are limited in the following ways:

    • Only one statement.
    • They must return a value.

    So the ForEach method on collections will not work with lambdas, and only the very simplest of operations will work. So most of the time you have to move your logic to some other method and use AddressOf. Many times this cleaves the readability of the code in a dramatic and heartbreaking way.

    It's something that I feel many would not pick up on unless they've used anonymous methods fluently in another language that fully supports them (C#, JavaScript, etc.), rather than the crippled support they have in VB 9.

    I'm extremely relieved that they're fixing lambdas in VB 10.

提交回复
热议问题