CoreTaskExtensionsSelectTResult Method (Task, FuncTask, TResult, Boolean) |
Namespace: Rackspace.Threading
public static Task<TResult> Select<TResult>( this Task task, Func<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 { await task.ConfigureAwait(false); } catch { if (!supportsErrors) throw; } return continuationFunction(task);
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 continuation is executed synchronously, this method should only be used for lightweight continuation functions. For non-trivial continuation functions, use a Task for the continuation operation and call ThenTResult(Task, FuncTask, TaskTResult, Boolean) instead. |