title: how to add a Cancellation Token to a Task?
body: <p>I am getting introduced to Task, and got this far:</p>
  
  <p>In Main:</p>
  
  <pre><code> Task&lt;double&gt; t = Task.Run(TW.DoingMegaFlops_Async);
  </code></pre>
  
  <p>Where in class TW:</p>
  
  <pre><code> public async Task&lt;double&gt; DoingMegaFlops_Async()
   {...await ...; return 0.0;}
  </code></pre>
  
  <p>My concept console app builds and runs just fine.
  The problem is how to expand this with a <code>Cancellation Token</code>. I tried this:</p>
  
  <pre><code>CancellationTokenSource wtokenSource= new CancellationTokenSource();
  Task.Run(TW.DoingMegaFlops_Async(wtokenSource.Token), wtokenSource.Token);
  </code></pre>
  
  <p>and in the TW class:</p>
  
  <pre><code>public async void DoingMegaFlops_Async(CancellationToken wtoken)
  {...await...; return;}
  </code></pre>
  
  <p>The build error in Main is:</p>
  
  <pre><code>Cannot convert from 'void' to 'System.Action'
  </code></pre>
  
  <p>I have already fooled around with casting to (Action), but with no avail.
  Actually, I do not really understand what I am doing here, so would like to learn from the forum.</p>
  
  <p>As you see from the code snippets, I already cut down on the interface of the Async method by going to a return type of void. Don't know if that actually made things easier.</p>