What do you think of multiline lambdas in VB 10

前端 未结 7 3090
抹茶落季
抹茶落季 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:47

    You are going to need multi-line once we get the ParallelFX library.

    For example, lets say you wanted to make this loop parallel:

    For i = 0 to 100
      '12 lines of code'
    Next
    

    The parallel version would be:

    Parallel.For( 0, 100, sub(i)
      '12 lines of code'
      End Sub )
    

    It works by turning the guts of the loop into a brand new sub. That new sub is called by N threads, N usually being the number of available cores.

提交回复
热议问题