I am simply trying to execute an otherwise blocking method asynchronously in one line in VB.
Dim action As New Action(Sub() MessageBox.Show("Hello"))
action.BeginInvoke(Nothing, Nothing)
In C#:
(new Action(() => MessageBox.Show("Hello"))).BeginInvoke(null, null);
Translated to VB
(New Action(Sub() MessageBox.Show("Hello"))).BeginInvoke(nothing, nothing)
does not compile. Syntax error when starting the line with a parenthesis.
Any solutions? If yes, what? If no, why not? Thanks!
I just tried this and got no issues: