Click or drag to resize
TaskExtensionsWithTimeout Method (Task, Int32)
Wraps a Task with a new Task which will throw a TimeoutException if the original Task takes longer than a specified number of milliseconds to complete.

Namespace: CodeTiger.Threading.Tasks
Assembly: CodeTiger.Core (in CodeTiger.Core.dll) Version:
public static Task WithTimeout(
	this Task task,
	int timeoutMilliseconds


Type: System.Threading.TasksTask
The original task.
Type: SystemInt32
The maximum number of milliseconds to wait for task to complete.

Return Value

Type: Task
A new Task which wraps task, or just task if either timeoutMilliseconds is equal to Infinite or task has already completed.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Task. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
TimeoutExceptionThrown when task takes longer than the specified number of milliseconds to complete.
See Also