title: Async, await and Task with ToList
body: <p>I am attempting to learn how to use await and async.</p>
  
  <p>I have a service layer, which has a reference data manager. My interface is:</p>
  
  <pre><code>public interface IReferenceDataService
      {
          Task&lt;List&lt;ReferenceItemDto&gt;&gt; GetAsync(ReferenceTypes type);
      }
  </code></pre>
  
  <p>When I try get my data in the UI, I am doing this:</p>
  
  <pre><code>    model.DeptPaymentTypes = _refDataService.GetAsync(Enums.ReferenceTypes.DeptPaymentTypes)
         .Select(x =&gt; new SelectListItem { 
            Text = x.Description, 
            Value = x.Id.ToString() })
          .ToList();
  </code></pre>
  
  <p>But am getting an error that, "ToList is not a definition for Task&lt;..."</p>
  
  <p>My data layer calls gets the data using Dapper QueryAsync...</p>
  
  <pre><code> public async Task&lt;List&lt;ReferenceItemDto&gt;&gt; GetAsync(Enums.ReferenceTypes type)
          {
              var table = string.Empty;
  
              if(type == Enums.ReferenceTypes.DaysOfMonth)
              {
                  var days = new List&lt;ReferenceItemDto&gt;();
                  for (int i = 1; i &lt;= 31; i++)
                  {
                      days.Add(new ReferenceItemDto
                      {
                          Description = i.ToString(),
                          Id = i
                      });
                  }
                  return days;
              }
  
  
              switch (type)
              {
                  case Enums.ReferenceTypes.SnowballTypes:
                      table = "SnowballType";
                      break;
                  case Enums.ReferenceTypes.DeptPaymentTypes:
                      table = "DebtPaymentType";
                      break;
                  default:
                      throw new System.Exception("Unknown data type in referenc manager.");
  
              }
              using (IDbConnection db = new SqlConnection("Data Source=......"))
              {
                  var data = await db.QueryAsync&lt;ReferenceItemDto&gt;("GetReferenceDataList", new { DataType = table }, commandType: CommandType.StoredProcedure);
                  return data.ToList();
              }
  
          }
  </code></pre>
  
  <p>What am I doing wrong? The ToList is causing me an issue.</p>