How to hydrate a Dictionary with the results of async calls? : <p>Suppose I have code that looks like this:</p>

<pre><code>public async Task&lt;string&gt; DoSomethingReturnString(int n) { ... }
int[] numbers = new int[] { 1, 2 , 3};
</code></pre>

<p>Suppose that I want to create a dictionary that contains the result of calling <code>DoSomethingReturnString</code> for each number similar to this:</p>

<pre><code>Dictionary&lt;int, string&gt; dictionary = numbers.ToDictionary(n =&gt; n,
    n =&gt; DoSomethingReturnString(n));
</code></pre>

<p>That won't work because DoSomethingReturnString returns <code>Task&lt;string&gt;</code> rather than <code>string</code>.  The intellisense suggested that I try specifying my lambda expression to be async, but this didn't seem to fix the problem either.</p>
