I want to run several tasks in async and wait for all of them to complete.
private static Task AddAFavicon(int id)
{
// some operation where each task create excel sheet as per id.
}
static void Main(string[] args)
{
// i have this main method which contain publications in list
XElement Publication = XElement.Load() // read publication from xml file.
foreach (var item in Publication.Descendants())
{
//here i want to call this AddAFavicon method for each item as async task
}
//wait for all task to complete
}
I want to wait for all tasks to complete and then do my other stuff. thanks in advance :)