What is the use of Deployment.Current.Dispatcher.BeginInvoke( ()=> {…} )?

后端 未结 3 951
一个人的身影
一个人的身影 2020-12-15 18:53

I have seen this Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} ) format in some code .Is it used to do some work in Background?What are the general uses of it?

3条回答
  •  失恋的感觉
    2020-12-15 19:30

    No, it's not to do work in a background thread - it's to do work on the UI thread. So it's normally called from a background thread, in order to manipulate the UI, which can only be done on the UI thread.

    The body of the lambda expression is the code which you want to execute in the UI thread.

提交回复
热议问题