internal static Task <TResult> ContinueWhenAll <TAntecedentResult>(Task <TAntecedentResult>[] tasks, Func <Task <TAntecedentResult>[], TResult> continuationFunction, TaskContinuationOptions continuationOptions, System.Threading.CancellationToken cancellationToken, TaskScheduler scheduler, ref StackCrawlMark stackMark)
 {
     TaskFactory.CheckMultiTaskContinuationOptions(continuationOptions);
     if (tasks == null)
     {
         throw new ArgumentNullException("tasks");
     }
     if (continuationFunction == null)
     {
         throw new ArgumentNullException("continuationFunction");
     }
     if (scheduler == null)
     {
         throw new ArgumentNullException("scheduler");
     }
     Task <TAntecedentResult>[] tasksCopy = TaskFactory.CheckMultiContinuationTasksAndCopy <TAntecedentResult>(tasks);
     if (cancellationToken.IsCancellationRequested)
     {
         return(TaskFactory <TResult> .CreateCanceledTask(continuationOptions));
     }
     return(TaskFactory.CommonCWAllLogic((Task[])tasksCopy).ContinueWith <TResult>(finishedTask => this.continuationFunction(this.tasksCopy), scheduler, cancellationToken, continuationOptions, ref stackMark));
 }