I have some threading checks and I can get the below working by calling BeginInvoke(new Action<string,string>........ but I was wondering if you can use pre-defined Actions somehow?
private Action<string, string> DoSomething();
private void MakeItHappen(string InputA, string InputB)
{
if (this.InvokeRequired)
{
this.BeginInvoke(DoSomething(InputA, InputB));
}
else
{
Label.Text = "Done";
MyOtherGUIItem.Visible = false;
}
}
You have to pass a plain
delegatetoBeginInvoke. You can use variable capture to wrap up your parameters like this: