【发布时间】:2010-11-05 16:59:42
【问题描述】:
我使用 Stack Overflow 用户提供的此功能从 BackgroundWorker 更新控件。
static void SynchronizedInvoke(ISynchronizeInvoke sync, Action action)
{
// If the invoke is not required, then invoke here and get out.
if (!sync.InvokeRequired)
{
// Execute action.
action();
// Get out.
return;
}
// Marshal to the required thread.
sync.Invoke(action, new object[] { });
}
到目前为止,此功能一直运行良好。我刚刚得到了这个例外:
这是什么意思,我该如何预防?
【问题讨论】:
标签: c# backgroundworker