Significant I could not say. The mechanisms are very different, but they serve for more or less the same thing, at least if Task.Run()
is used to solve the same problem.
Obviously the way to use it is quite different, especially if you want to be notified of progress, but the result does not change much.
BackgroundWorker
would not have been created if .Net had await
from the beginning. It is more modern, it is the right way to do it, it was better thought and it is a more general mechanism. Certainly the most modern form is simpler to write and for me it is more intuitive.
There is nothing wrong with continuing with the old form if you prefer, but is considered obsolete .
Of course, if comparing Task.Run()
with no context does not give, it is more powerful, flexible and general. The comparison only fits in a very specific form of its use.
Example of an operation that does not hang the UI:
private async void buttonGeraBoletos_Click(object sender, EventArgs e) {
await Task.Run(() => GeraBoletos());
MessageBox.Show("Tudo gerado");
}
You can do it in parallel too, which can end up much faster.