예제 #1
0
 public static ConfiguredValueTaskAwaitable NoContext(this ValueTask task)
 => task.ConfigureAwait(false);
예제 #2
0
 public static ConfiguredValueTaskAwaitable <T> NoContext <T>(this ValueTask <T> task)
 => task.ConfigureAwait(false);
예제 #3
0
 /// <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);
예제 #4
0
 /// <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();
예제 #5
0
 public static TResult Run <TResult>(this ValueTask <TResult> task, bool continueOnCaputedContext = false)
 => task.ConfigureAwait(continueOnCaputedContext).GetAwaiter().GetResult();
예제 #6
0
        public static async ValueTask <Unit> AsValueTaskUnit <T>(this ValueTask <T> task)
        {
            await task.ConfigureAwait(false);

            return(Unit.Value);
        }
예제 #7
0
 public static async ValueTask <object> AsValueTaskObject <T>(this ValueTask <T> task) =>
 await task.ConfigureAwait(false);