开发者

Can SynchronizationContext.Post or .Send lead to exceptions?

I've read all recommended articles on SynchronizationContext, but there is one small question I did not find an answer for. In my case I have an event handler that calls a Log() method that outputs text to a TextBox. Log() is called from a WCF service. The event is raised from WCF client instances (threads). Usually, I check Control.InvokeRequired to be sure I am on the correct thread.

开发者_StackOverflow

Do I still need to do that when using SynchronizationContext? In other words, can I always do a .Post() or .Send() even if I'm already on the correct thread?


Using Post or Send if you're already on the correct thread is not necessary, but it will work

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜