I would like to know if there is any overhead incurred through the use of anonymous methods when creating a Background worker.
for example:
public void SomeMethod()
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
//large amount of code
}
worker.RunWorkerAsync();
}
Would the example above be any better or worse than defining the //large amount of code
in a separate method?
Is there any overhead incurred in defining the background worker method in-line, particularly if SomeMethod()
is called often?