CoreTaskExtensionsThenTSource, TResult Method (TaskTSource, FuncTaskTSource, TaskTResult, Boolean) |
Namespace: Rackspace.Threading
public static Task<TResult> Then<TSource, TResult>( this Task<TSource> task, Func<Task<TSource>, Task<TResult>> continuationFunction, bool supportsErrors )
Exception | Condition |
---|---|
ArgumentNullException |
If task is . -or- If continuationFunction is . |
This code implements support for the following construct without requiring the use of /.
try { TSource source = await task.ConfigureAwait(false); } catch { if (!supportsErrors) throw; } return await continuationFunction(task).ConfigureAwait(false);
If the antecedent task is canceled, or faulted with supportsErrors set to , the status of the antecedent is directly applied to the task returned by this method; it is not wrapped in an additional AggregateException.
Notes to Callers |
---|
Since the continuationFunction is executed synchronously, this method should only be used for lightweight continuation functions. This restriction applies only to continuationFunction itself, not to the Task returned by it. |