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? 回答1: VB.NET lacks this Interesting bits: (..)VB does not have anonymous methods, only Lambda expressions (no way to declare an anonymous Action delegate). 回答2: You can't make it that way, but you can make it work like: Sub New()