API reference
API reference
Select your platform
No SDKs available
No versions available

TaskExtensions Class

A static class used for adding new Task options

Static Methods

TimeoutAfter ( task , ms )
Causes a task to timeout after a given amount of time in ms. The task's result will be an error message
Signature
static async Task<bool> Meta.WitAi.TaskExtensions.TimeoutAfter(this Task task, int ms)
Parameters
task: this Task  The task to wait for
ms: int  The amount of time to wait
Returns
async Task< bool >  Returns true if this task ran to completion without timing out
Throws
AggregateException
WhenLessThan ( tasks , max )
A task that completes when less than the specified max tasks are running
Signature
static Task Meta.WitAi.TaskExtensions.WhenLessThan(this ICollection< Task > tasks, int max)
Parameters
tasks: this ICollection< Task >
max: int
Returns
Task
WhenLessThan ( tasks , max , cancellationToken )
A task that completes when less than the specified max tasks are running
Signature
static Task Meta.WitAi.TaskExtensions.WhenLessThan(this ICollection< Task > tasks, int max, CancellationToken cancellationToken)
Parameters
tasks: this ICollection< Task >
max: int
cancellationToken: CancellationToken
Returns
Task
WrapErrors ( task )
Signature
static void Meta.WitAi.TaskExtensions.WrapErrors(this Task task)
Parameters
task: this Task
Returns
void