Just fire the task without async/await without async/await.
private void InitMethod(ServiceControl serviceControl)
{
if (serviceControl != null)
{
Task.Factory.StartNew(() => serviceControl.Execute());
}
}
In a proper F&F task all exception handling (including a final catch, logging, notifications) is done by the task itself, so you don't need exception handling that async/await
provides.
Make the method name reflect what it does. I wouldn't mind a name like FireAndForgetXyz
Just fire the task without async/await.
private void InitMethod(ServiceControl serviceControl)
{
if (serviceControl != null)
{
Task.Factory.StartNew(() => serviceControl.Execute());
}
}
In a proper F&F task all exception handling (including a final catch, logging, notifications) is done by the task itself, so you don't need exception handling that async/await
provides.
Make the method name reflect what it does. I wouldn't mind a name like FireAndForgetXyz
Just fire the task without async/await.
private void InitMethod(ServiceControl serviceControl)
{
if (serviceControl != null)
{
Task.Factory.StartNew(() => serviceControl.Execute());
}
}
In a proper F&F task all exception handling (including a final catch, logging, notifications) is done by the task itself, so you don't need exception handling that async/await
provides.
Make the method name reflect what it does. I wouldn't mind a name like FireAndForgetXyz
Just fire the task without async/await.
private void InitMethod(ServiceControl serviceControl)
{
if (serviceControl != null)
{
Task.Factory.StartNew(() => serviceControl.Execute());
}
}
In a proper F&F task all exception handling (including a final catch, logging, notifications) is done by the task itself, so you don't need exception handling that async/await
provides.
Make the method name reflect what it does. I wouldn't mind a name like FireAndForgetXyz