Q:

Task List - start and then waitall

I want to do with List what the first method does with array.   
The situation is don't know how many Tasks up front.  I don't want to fill up a List before starting the task as it takes a while to fill up the list.   
public void TaskArray()
{
    ConcurrentBag<int> cb = new ConcurrentBag<int>();
    Task[] taskArray = new Task[10];
    for (int i = 0; i < 100; i++)
    {
        taskArray[i] = Task. Factory. StartNew((Object obj) => {

            Console. WriteLine("Task #{0} created at {1} on thread #{2}.", 
                                i, Thread. CurrentThread. ManagedThreadId);
        },
                                                i);
    }
    Task. WaitAll(taskArray);
}

This has syntax errors.  
Cannot convert from system.generic.task.list to system.threading.task.task 
public void TaskList()
{
    ConcurrentBag<int> cb = new ConcurrentBag<int>();
    List<Task> taskArray = new List<Task>;
    for (int i = 0; i < 100; i++)
    {
        taskArray. Add(Task. Factory. StartNew((Object obj) => {
            cb. Add(i);
            Console. WriteLine("Task #{0} created at {1} on thread #{2}.", 
                                i, Thread. CurrentThread. ManagedThreadId);
        },
                                                i));
    }
    Task. WaitAll(taskArray);
}

A:

Assuming taskArray is a List<Task> you may just use:
Task. WaitAll(taskArray. ToArray());

