How to use BeginInvoke in VB.NET
<p>In C# you use <code>BeginInvoke</code> like this:  </p>

<pre><code>obj.BeginInvoke((Action)(() =&gt;
{
    //do something
}));
</code></pre>

<p>I tried to translate it to VB.NET, and ended up with this code, that seems to work:  </p>

<pre><code>obj.BeginInvoke(
    Sub()
        'do something'
    End Sub
)
</code></pre>

<p>The snippets look very different to me, especially because the <code>(Action) (() =&gt;</code> part is missing completely. Is this the correct way to use <code>BeginInvoke</code> in VB.NET?  </p>

<hr>

<p>this is <strong>not</strong> a duplicate of <a href="https://stackoverflow.com/questions/14388136/how-to-use-begininvoke-c-sharp">How to use BeginInvoke C#</a> because the question and every answer uses C# (if any programming language is used). C#-code doesn't help much when you are unsure about if you used the correct VB.NET syntax.</p>