我一直在尝试向我的应用程序中的一些ListBox添加一些字符串(简单的winform)- 我使用了BeginInvoke来实现
myListBox.BeginInvoke(new Action(delegate()
{
myListBox.Items.Add( "some string" ));
}));
在我再次阅读这三行代码后,我不明白为什么在任何一个跨线程UI的例子中,无论是在谷歌还是MSDN上,我都没有看到任何对EndInvoke方法的调用?难道在这种情况下不需要调用EndInvoke吗?
Control.…Invoke
和TDelegate.…Invoke
之间的比较列表应该出现在MSDN上。-- 我只建议你在旁注中解释一下WPF / Silverlight的“Dispatcher”,因为它在Windows Forms中不存在(这是这个问题的背景)。 - stakx - no longer contributing