In C#
(new Action(() => MessageBox.Show("Hello"))).BeginInvoke(null, null);
In VB the translated code doesn’t compile
(New Action(Sub() MessageBox.Show("Hello"))).BeginInvoke(nothing, nothing)
But in VB I can set the result of BeginInvoke to implicit variable a and it will run (thanks @Ric for this suggestion in another post)
Dim a = (New Action(Sub() MessageBox.Show("Hello"))).BeginInvoke(Nothing, Nothing)
But now I want to know why VB requires something to be set on the left hand side in this case, where C# does not.
VB.NET simply requires an identifier. You can’t invoke a sub or other member directly like that. You can, however, use
Callinstead.