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

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

Parameters

task
Type: System.Threading.TasksTaskTResult
The original task.
timeout
Type: SystemTimeSpan
The maximum amount of time to wait for task to complete.

Type Parameters

TResult
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).
Exceptions
ExceptionCondition
TimeoutExceptionThrown when task takes longer than the specified amount of time to complete.
See Also