With a “classic” method implementation, I usually perform BeginInvoke like this:
private delegate void FooDelegate();
public void Foo()
{
if(InvokeRequired)
{
BeginInvoke(new FooDelegate(Foo));
return;
}
// Do what you want here
}
How to do the same thing when the method is an explicit interface member declaration? Like:
public void IFace.Foo()
{
// Need to BeginInvoke here
}
This does not work:
private delegate void FooDelegate();
public void IFace.Foo()
{
if(InvokeRequired)
{
BeginInvoke(new FooDelegate(IFace.Foo));
return;
}
// Do what you want here
}
You have to cast
thistoIFacefirst: