I have simple (as i think) logic.
public static void NotifyAboutNewJob(int jobId, bool forceSending = false)
{
Action<int> notifier = SendAppleNotifications;
notifier.BeginInvoke(jobId, null, null);
}
Method SendAppleNotifications had one parametera and it was easy to pass it into BeginInvoke
. Now i have added second parameter forceSending
. And problem - i don't know how to pass it into BeginInvoke
.
Should i pass it as 3rd param as object
?
private static void SendAppleNotifications(int jobId, bool forceSending = false){...}
Or this is the answer :
Action<int, bool> notifier = SendAppleNotifications;
notifier.BeginInvoke(jobId, forceSending, null, null);
Task.Run(() => SendAppleNotifications(jobId, forceSending));
– Torpedo