Stop Task when task run
<p>How can i totally stop a task when task running?</p>

<pre><code>private async void button1_Click(object sender, EventArgs e)
{
  await Backup(file);
}

public async Task Backup(string File)
{
   await Task.Run(() =&gt;
     {
       1)do something here

       2)do something here

       3)do something here

      });
}
private async void button2_Click(object sender, EventArgs e)
{
  &lt;stop backup&gt;
}
</code></pre>

<p>If say i want to stop task during 2nd thing is processing, and i click a button2 then the task will stop process</p>

<p>How do I cancel or end the task from <code>button2_Click</code>?</p>