title: Invoking a method's result to the main thread
body: <p>I am wondering about the following:</p>
  
  <p>I have an observable collection named <code>Container</code> and method named <code>Method</code>.</p>
  
  <p>On the main thread I want to add the returned value from <code>Method</code> to the <code>Container</code>.</p>
  
  <p>The following code runs on another thread, so I have to Invoke the <code>Container.Add</code> to the app current thread to not have errors:</p>
  
  <pre><code>object obj = Method()
  App.Current.Dispatcher.Invoke(() =&gt; {
      Container.Add((MyObject)obj)
  });
  </code></pre>
  
  <p>My question is if I would do the following</p>
  
  <pre><code>App.Current.Dispatcher.Invoke(() =&gt; {
      Container.Add((MyObject)Method())
  });
  </code></pre>
  
  <p>The method (which is a long running method) will run on the app current thread, which is not quite correct because it will hand the UI, could I invoke only the returned value of the method to be added to the <code>Container</code> without defining the object like in the first example?</p>