OrleansTaskExtentions.WithTimeout Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
WithTimeout(Task, TimeSpan, String) |
This will apply a timeout delay to the task, allowing us to exit early |
WithTimeout<T>(Task<T>, TimeSpan, String) |
This will apply a timeout delay to the task, allowing us to exit early |
WithTimeout(Task, TimeSpan, String)
- Source:
- TaskExtensions.cs
This will apply a timeout delay to the task, allowing us to exit early
public static System.Threading.Tasks.Task WithTimeout (this System.Threading.Tasks.Task taskToComplete, TimeSpan timeout, string exceptionMessage = default);
static member WithTimeout : System.Threading.Tasks.Task * TimeSpan * string -> System.Threading.Tasks.Task
<Extension()>
Public Function WithTimeout (taskToComplete As Task, timeout As TimeSpan, Optional exceptionMessage As String = Nothing) As Task
Parameters
- taskToComplete
- Task
The task we will timeout after timeSpan
- timeout
- TimeSpan
Amount of time to wait before timing out
- exceptionMessage
- String
Text to put into the timeout exception message
Returns
The completed task
Exceptions
If we time out we will get this exception
Applies to
WithTimeout<T>(Task<T>, TimeSpan, String)
- Source:
- TaskExtensions.cs
This will apply a timeout delay to the task, allowing us to exit early
public static System.Threading.Tasks.Task<T> WithTimeout<T> (this System.Threading.Tasks.Task<T> taskToComplete, TimeSpan timeSpan, string exceptionMessage = default);
static member WithTimeout : System.Threading.Tasks.Task<'T> * TimeSpan * string -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function WithTimeout(Of T) (taskToComplete As Task(Of T), timeSpan As TimeSpan, Optional exceptionMessage As String = Nothing) As Task(Of T)
Type Parameters
- T
Parameters
- taskToComplete
- Task<T>
The task we will timeout after timeSpan
- timeSpan
- TimeSpan
Amount of time to wait before timing out
- exceptionMessage
- String
Text to put into the timeout exception message
Returns
The value of the completed task
Exceptions
If we time out we will get this exception