Using C# MethodInvoker.Invoke() for a GUI app… is this good?

前端 未结 5 1777
死守一世寂寞
死守一世寂寞 2020-12-01 01:01

Using C# 2.0 and the MethodInvoker delegate, I have a GUI application receiving some event from either the GUI thread or from a worker thread.

I use the following pa

5条回答
  •  隐瞒了意图╮
    2020-12-01 01:40

    For WinForms, calling Control.Invoke(Delegate) sends a message to the UI's thead's message pump. The thread then processes the message and calls the delegate. Once it has been processed, Invoke stops blocking and the calling thread resumes running your code.

提交回复
热议问题