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 through 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.