Class TaskHelper
Helpers for working with Tasks.
public static class TaskHelper
- Inheritance
-
TaskHelper
- Inherited Members
Methods
ForceExceptionsIntoTaskAsync(Func<Task>)
Executes an asynchronous method, ensuring any exceptions thrown synchronously are reported via the returned Task.
public static Task ForceExceptionsIntoTaskAsync(Func<Task> function)
Parameters
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- ArgumentNullException
functionis null. This exception will be thrown synchronously, not returned through the returned Task object.
ForceExceptionsIntoTaskAsync<TResult>(Func<Task<TResult>>)
Executes an asynchronous method, ensuring any exceptions thrown synchronously are reported via the returned Task<TResult>.
public static Task<TResult> ForceExceptionsIntoTaskAsync<TResult>(Func<Task<TResult>> function)
Parameters
Returns
- Task<TResult>
A task that represents the asynchronous operation. The value of its Result property contains the result.
Type Parameters
TResultThe type of the result produced by the Task<TResult>.
Exceptions
- ArgumentNullException
functionis null. This exception will be thrown synchronously, not returned through the returned Task<TResult> object.