public static ConfiguredValueTaskAwaitable NoContext(this ValueTask task) => task.ConfigureAwait(false);
public static ConfiguredValueTaskAwaitable <T> NoContext <T>(this ValueTask <T> task) => task.ConfigureAwait(false);
/// <summary> /// Fires and forgets the tasks. /// </summary> /// <typeparam name="TResult">Type of the result object.</typeparam> /// <param name="task">The task that will run.</param> /// <param name="continueOnCapturedContext">Indicates if the task should continue in a captured context.</param> public static void RunAsync <TResult>(this ValueTask <TResult> task, bool continueOnCapturedContext = false) => _ = task.ConfigureAwait(continueOnCapturedContext);
/// <summary> /// Runs a <see cref="ValueTask"/> synchronously. /// </summary> /// <param name="task">The task that will run.</param> /// <param name="continueOnCapturedContext">Indicates if the task should continue in a captured context.</param> public static void Run(this ValueTask task, bool continueOnCapturedContext = false) => task.ConfigureAwait(continueOnCapturedContext).GetAwaiter().GetResult();
public static TResult Run <TResult>(this ValueTask <TResult> task, bool continueOnCaputedContext = false) => task.ConfigureAwait(continueOnCaputedContext).GetAwaiter().GetResult();
public static async ValueTask <Unit> AsValueTaskUnit <T>(this ValueTask <T> task) { await task.ConfigureAwait(false); return(Unit.Value); }
public static async ValueTask <object> AsValueTaskObject <T>(this ValueTask <T> task) => await task.ConfigureAwait(false);