title: Fire and Forget multiple methods in C#
body: <p>I have an Azure function which would have the ability to call multiple API endpoints without waiting for the results from any of them.</p>
  
  <p>The Azure function runs on a timer trigger and runs every 10 seconds.</p>
  
  <p>All my API calls and parameters to call them are stored in a SQL table.  I want to make sure that the API calls are made without waiting for a particular call to be finished. </p>
  
  <p>This is just a blueprint of what I'll be doing.</p>
  
  <pre><code>[FunctionName("FunctionScheduler")]
  public static async Task RunAsync([TimerTrigger("*/10 * * * * *")]TimerInfo myTimer, ILogger log)
  {
      log.LogInformation("FUNCTION SCHEDULER STARTING ..");
  
      log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
  
      for(int i=0; i &lt; 20; i++)
      {
          var task = Task.Run(() =&gt; ApiRef1(i, log));
          var taskref = await task;
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Currently ApiRef1() simply prints out the value of the variable i.  I get the expected output of printing numbers 0 to 19.  I want parallel executions of the ApiRef1() method which will eventually be replace by a method that looks like this.</p>
  
  <pre><code>private static void CallApi(string apiName, string apiEndpoint, string methodType, string authenticationType, IDictionary&lt;int, string&gt; parameters, ILogger log)
  {
      try
      {
          log.LogInformation($"Call to API {apiName} started.." );
  
          // Call API
      }
      catch (Exception ex)
      {
          log.LogInformation($"Exception {ex.Message} occurred.." );
      }
  }
  </code></pre>
  
  <p>Is there a better way to do this or will this method work?</p>