I have the following function:
private void SendSMSs(List<SMS> smsList)
{
foreach (var sms in smsList)
{
SendSMS smsSend = new SendSMS(sms.message, sms.number, 0, SmsResponseCallback);
Console.WriteLine("Sent a SMS to " + sms.number);
}
}
/// <summary>
/// Call back for sending a sms
/// </summary>
public void SmsResponseCallback(FSK_SendSMS.FSK_SendSMS.SMS_Result result)
{
Console.WriteLine("Succesfully sent a SMS to " + result.Destination + " with result: " + result.Result);
}
Now my issue is that each sms waits till it gets a response from the recipient.
I want to create a task for each sms that needs to be sent. So that they can all be sent asynchronously.
The function SendSMSs does need to wait for the tasks to Finnish. It must return as soon as it can, and the sms will then be sent in their own time?
So how can I create a task which will start straight away and then I can move on and create the next.