开发者

Dispatcher.CurrentDispatcher?

开发者 https://www.devze.com 2022-12-29 08:07 出处:网络
If I do this... public PriorityQueue(Dispatcher dispatcher = null) { this.dispatcher = dispatcher ?? Dispatcher.CurrentDispatcher;

If I do this...

public PriorityQueue(Dispatcher dispatcher = null)
{
    this.dispatcher = dispatcher ?? Dispatcher.CurrentDispatcher;
}

And then use it in a ViewModel (without passing any args) that is created t开发者_Go百科hrough the XAML, this.dispatcher will point to the UI thread right?


If it is created from within the UI thread (which it would be, if instantiated inside XAML), then yes, it will point to the UI thread's Dispatcher.

0

精彩评论

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