Click or drag to resize
TaskExtensionsWithTimeoutTResult Method (TaskTResult, Int32)

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


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

Type Parameters

The type of the result produced by the task.

Return Value

Type: TaskTResult
A new TaskTResult 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 TaskTResult. 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