title: How to use async within a lambda which returns a collection
body: <p>I have a method which is Async "upstream". I'm trying to follow best practice and go all-in qith async all the way up the stack.</p>
  
  <p>Within a Controller action within MVC I predictably hit the deadlock issue If I rely on .Result().</p>
  
  <p>Changing the Controller action to async seems to be the way to go, though the issue is that the async method is called multiple times within a lambda.</p>
  
  <p>How can I await on a lamda <em>that returns multiple results</em>?</p>
  
  <pre><code>public async Task&lt;JsonResult&gt;  GetLotsOfStuff()
  {
      IEnumerable&lt;ThingDetail&gt; things=  previouslyInitialisedCollection
                                        .Select(async q =&gt; await GetDetailAboutTheThing(q.Id)));
      return Json(result, JsonRequestBehavior.AllowGet);
  
  }
  </code></pre>
  
  <p>You can see I have tried making the lambda async, but this just gives a compiler exception:</p>
  
  <p>Cannot convert source type </p>
  
  <blockquote>
    <blockquote>
      <p><code>System.Collections.Generic.IEnumerable&lt;System.Threading.Tasks.Task&lt;ThingDetail&gt;</code> to target type <code>System.Collections.Generic.IEnumerable&lt;ThingDetail&gt;</code> </p>
    </blockquote>
  </blockquote>
  
  <p>Where am I going wrong here?</p>