title: Call method on UI thread from background in .net 2.0
body: <p>I am using MonoDevelop (.net 2.0) to develop a iOS and Android app. I use BeginGetResponse and EndGetResponse to asynchronously do a webrequest in a background thread.</p>
  
  <pre><code>IAsyncResult result = request.BeginGetResponse(new AsyncCallback(onLogin), state);
  </code></pre>
  
  <p>However, the callback <code>onLogin</code> does seem to still be running on a background thread, no allowing me to interact with the UI. How do I solve this?</p>
  
  <p>Can see that there are Android and iOS specific solutions but want a cross-platform solution.</p>
  
  <p><strong>Edit:</strong> From mhutch answer I've got this far:</p>
  
  <pre><code>IAsyncResult result = request.BeginGetResponse(o =&gt; {
              state.context.Post(() =&gt; { onLogin(o); });
          }, state);
  </code></pre>
  
  <p>Where state contains a <code>context</code> variable of type <code>SynchronizationContext</code> set to <code>SynchronizationContext.Current</code></p>
  
  <p>It complains that Post requires two arguments, the second one being <code>Object state</code>. Inserting <code>state</code> gives the error </p>
  
  <pre><code>Argument `#1' cannot convert `anonymous method' expression to type `System.Threading.SendOrPostCallback' (CS1503) (Core.Droid)
  </code></pre>