/// <summary> /// Execute the Task. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <typeparam name="TException">Type of exception of the exception handler.</typeparam> /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param> /// <param name="task">Executed Task.</param> /// <param name="iterations">Number of executing Task iterations.</param> public static async ValueTask StartAsync <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, ValueTask task, uint iterations = 1) where TClass : class where TException : Exception { await codeExecutorBuilder.ExecuteAsync(task, iterations).ConfigureAwait(false); }
/// <summary> /// Execute the Task. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <typeparam name="TException">Type of exception of the exception handler.</typeparam> /// <typeparam name="TResult">Type of result.</typeparam> /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param> /// <param name="task">Executed Task.</param> /// <param name="defaultResult">Default result if exception will occured.</param> /// <returns> /// Returns result. /// </returns> public static async ValueTask <TResult> StartAsync <TClass, TException, TResult>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, ValueTask <TResult> task, TResult defaultResult = default) where TClass : class where TException : Exception { return(await codeExecutorBuilder.ExecuteAsync(task, defaultResult).ConfigureAwait(false)); }
/// <summary> /// Execute the Task. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <typeparam name="TException">Type of exception of the exception handler.</typeparam> /// <param name="codeExecutorBuilder"><see cref="CodeExecutorBuilder{TClass, TException}"/>.</param> /// <param name="task">Executed Task.</param> public static async Task StartAsync <TClass, TException>(this CodeExecutorBuilder <TClass, TException> codeExecutorBuilder, Task task) where TClass : class where TException : Exception { await codeExecutorBuilder.ExecuteAsync(task).ConfigureAwait(false); }