I read that backgroundworker will be replaced by task. So i need to ask if there is any difference in performance. And how i will replace my existing code using task instead background worker.
OnLoad
Timer timer = new Timer();
timer.Interval = (3000); // * second
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
private void timer_Tick(object sender, EventArgs e)
{
if (!backgroundWorker.IsBusy)
backgroundWorker.RunWorkerAsync();
}
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
//Here i'm running my code
}
Every 3 seconds my background worker runs a specfic routine inside my main. How can i replace it with task?