title: Simplify Task foreach loop c#
body: <p>I have a number of foreach loops where I am adding items to a list of Tasks to await on before continuing.</p>
  
  <p>I have the following layout for each, however I feel this is fairly verbose so wanted to see if there was a more succinct way to write this?</p>
  
  <p>I need to catch any errors for each DoTaskOnItem and log this and continue with any other tasks still remaining.</p>
  
  <pre><code>    private async Task DoListOfTasks(List&lt;string&gt; items)
      {
          List&lt;Task&gt; tasks = new List&lt;Task&gt;();
          foreach (var item in items)
          {
              var task = Task.Run(async () =&gt;
              {
                  try
                  {
                      await DoTaskOnItem(item);
                  }
                  catch
                  {
                      AddErrorMessage($"Error: {item}");
                  }
              });
  
              tasks.Add(task);
          }
  
          await Task.WhenAll(tasks);
      }
  </code></pre>