开发者

Can I simply use delegate even though it may not be required?

Can I 开发者_高级运维simply use delegate even though it may not be required?


When calling Control.Invoke, you don't need to check InvokeRequired, it checks it for you.

Control.BeginInvoke from the same thread is useful at times, it puts the call on the end of the message queue instead of making it immediately.

It's really not clear enough what you're doing to give specific advice.


Looking at your sample code, this is all you need:

WirelessGreenLight.Invoke(new MethodInvoker(redGreenLight));

or, if you can't change the caller:

public void redGreenLight()
{
    WirelessGreenLight.Invoke(new MethodInvoker(redGreenLightImpl));
}

private void redGreenLightImpl()
{
    // real work done here
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜