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

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


Type: System.Threading.TasksTaskTResult
The original task.
Type: SystemTimeSpan
The maximum amount of time 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 timeout is equal to InfiniteTimeSpan 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 amount of time to complete.
See Also