Search code examples
c#vb.netlambdaanonymous-methods

C# to VB - How do I convert this anonymous method / lambda expression across?


How would you convert this to VB (using .NET 4.0 / VS2010) ?

bw.DoWork += (o, args) =>
{
     Code Here
};

I thought maybe like this:

AddHandler bw.DoWork,
    Function(o, args)

        Code Here

    End Function

But it says Function does not return a value on all code paths.

Ideas?


Solution

  • VB.NET lacks this

    Interesting bits:

    (..)VB does not have anonymous methods, only Lambda expressions (no way to declare an anonymous Action delegate).