title: Returning a Task of type Task<Dictionary<string, string>>
body: <p>I've been trying to figure out how to return data in type Task other than an int like this for example, <code>Task&lt;Dictionary&lt;string, string&gt;&gt;</code>.  </p>
  
  <p>All the examples I seem to find all show returning an <code>Task&lt;int&gt;</code>. which is easy enough to do by saying <code>return 42;</code>.</p>
  
  <p>The function I've been trying to write works something like this:</p>
  
  <pre><code>Task&lt;Dictionary&lt;string, string&gt;&gt; getDamaged()
  {
      Task&lt;Dictionary&lt;string, string&gt;&gt; d = new Task&lt;Dictionary&lt;string, string&gt;&gt;();
      Dictionary&lt;string, string&gt; e = new Dictionary&lt;string, string&gt;();
  
      foreach (Building i in buildingArray)
      {
          if (Convert.ToInt32(i.efficiency) &lt; 100)
          {
              e.Add(i.buildingID, i.buildingName);
              //d.Add(i.buildingID, i.buildingName);  // this does not work, either
          }
      }
  </code></pre>
  
  <p>I found the <a href="http://msdn.microsoft.com/en-us/library/hh194922.aspx" rel="nofollow" title="MSDN reference page">Task.FromResult method</a> which looked somewhat promising, but further investigation appears to show that <code>TResult</code> as a completed task which to me sounds not necessarily like one that you can <code>await</code>.</p>
  
  <p>Any ideas on how to get this working correctly?</p>
  
  <p><em>Update</em></p>
  
  <p>The point of this method is I am trying to offload work from my UI thread to keep my UI responsive.  This is one of my first attempts at really trying to do this using visual studio 2012 with .net4.5.  The code above I wrote from memory.  I'll post the actual code I've been attempting along with commented out failed attempts.</p>
  
  <p>One part that really bugs me is that if I return a int if my return type is task, but if I try with dictionary I get an error about cannot implicitly convert a dictionary  to a task</p>
  
  <pre><code>    private Task&lt;Dictionary&lt;string, string&gt;&gt; GetDamagedBuildings()
      {
          //Task&lt;Dictionary&lt;string, string&gt;&gt; damagedBuildings = new Task&lt;Dictionary&lt;string,string&gt;&gt;();
          Dictionary&lt;string, string&gt; d = new Dictionary&lt;string, string&gt;();
          foreach (ButtonPlanetMap i in buttonArray)
          {
              //Dictionary&lt;string, string&gt; d = new Dictionary&lt;string,string&gt;();
              if (Convert.ToInt32(i.efficiency) &lt; 100)
              {
                  d.Add(i.buildingID.ToString(), i.buildingName);
                  //(Dictionary&lt;string, string&gt;)damagedBuildings.
              }
          }
          //damagedBuildings = Cast d;
          //return damagedBuildings;
          return d;
      }
  </code></pre>