Update UI from background Thread

后端 未结 6 1332
悲&欢浪女
悲&欢浪女 2020-12-20 10:33

This is just a curious question. Which one is the best way to update UI from another thread. First, this one:

private delegate void MyDelegateMethod();
void          


        
6条回答
  •  一个人的身影
    2020-12-20 10:58

    The first method (BeginInvoke) ensures that the UI update code executes on the same thread that created the control. The 2nd method does not. Having all UI updating code execute on the same thread avoids alot of threading issues and allows you to use controls that are not necessarily thread-safe.

提交回复
热议问题