I need to convert the following C# code to VB.NET:
if (this.InvokeRequired)
{
this.BeginInvoke((Action)(() =>
{
imageMutex.WaitOne();
pbCamera.Image = (Bitmap)imageCamera.Clone();
imageMutex.ReleaseMutex();
}));
}
I have tried it like this:
If Me.InvokeRequired Then
Me.BeginInvoke((Action)(Function()
imageMutex.WaitOne()
pbCamera.Image = CType(imageCamera.Clone(), Bitmap)
imageMutex.ReleaseMutex()
))
End If
But the compiler tells me that Action
is a type and can not be used as an expression.
How would such a delegate by written in VB.NET?