What values use ContinueWith(Action<Task> continuationAction) for CancellationToken, TaskContinuationOptions and TaskScheduler and where can I find this in the official documentation?
What are the ContinueWith default values
1.4k Views Asked by Jotrius At
2
There are 2 best solutions below
0
On
You can look at most of the actual source code for .Net on http://referencesource.microsoft.com/. In your case the exact overload (ContinueWith(Action<Task> continuationAction)) looks like this:
public Task ContinueWith(Action<Task> continuationAction)
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return ContinueWith(continuationAction, TaskScheduler.Current, default(CancellationToken), TaskContinuationOptions.None, ref stackMark);
}
So, for CancellationToken it's default(CancellationToken) which is equivalent to CancellationToken.None.
For TaskContinuationOptions it's TaskContinuationOptions.None.
For TaskScheduler it's TaskScheduler.Current
MSDN does not explicitly state this but usually when you have method overloads, all other parameters are "default". Let's find this method in .NET source:
So default
CancellationToken(that isCancellationToken.None), emptyTaskContinuationOptionsand currentTaskSchedulerare used.