title: Getting result of .Net object asynchronous method in powershell
body: <p>I'm trying to call an async method on a .Net object instantiated in Powershell :</p>
  
  <pre><code>Add-Type -Path 'my.dll'
  
  $myobj = new-object mynamespace.MyObj()
  
  $res = $myobj.MyAsyncMethod("arg").Result
  
  Write-Host "Result : " $res
  </code></pre>
  
  <p>When executing the script, the shell doesn't seem to wait for <code>MyAsyncMethod().Result</code> and displays nothing, although inspecting the return value indicates it is the correct type (<code>Task&lt;T&gt;</code>). Various other attempts, such as intermediary variables, <code>Wait()</code>, etc. gave no results.</p>
  
  <p>Most of the stuff I found on the web is about asynchronously calling a Powershell script from C#. I want the reverse, but nobody seems to be interested in doing that. Is that even possible and if not, why ?</p>