title: Run async method regularly with specified interval
body: <p>I need to publish some data to the service from the C# web application. The data itself is collected when user uses the application (a kind of usage statistics). I don't want to send data to the service during each user's request, I would rather collect the data in the app and send then all the data in a single request in a separate thread, that does not serve the users requests (I mean user does not have to wait for the request to be processed by the service). For this purpose I need a kind of JS's <code>setInterval</code> analog - the launch of the function each X seconds to flush all collected data to the service.  </p>
  
  <p>I found out that <a href="https://msdn.microsoft.com/en-us/library/System.Timers.Timer(v=vs.110).aspx" rel="noreferrer"><code>Timer</code></a> class provides somewhat similar (<a href="https://msdn.microsoft.com/en-us/library/system.timers.timer.elapsed%28v=vs.110%29.aspx" rel="noreferrer"><code>Elapsed</code></a> event). However, this allows to run the method only once, but that's not a big issue. The main difficulty with it is that it requires the signature</p>
  
  <pre><code>void MethodName(object e, ElapsedEventArgs args)
  </code></pre>
  
  <p>while I would like to launch the async method, that will call the web-service (input parameters are not important):</p>
  
  <pre><code>async Task MethodName(object e, ElapsedEventArgs args)
  </code></pre>
  
  <p>Could anyone advise how to solve the described task? Any tips appreciated.</p>