DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.1.0" />

 Synchronization

public static class Synchronization
Represents task synchronization methods.
public static Result<TResult> GetResult<TResult>(this Task<TResult> task, TimeSpan timeout)

Gets task result synchronously.

public static Result<TResult> GetResult<TResult>(this Task<TResult> task, CancellationToken token)

Gets task result synchronously.

public static Result<object> GetResult(this Task task, CancellationToken token)

Gets task result synchronously.

public static Result<object> GetResult(this Task task, TimeSpan timeout)

Gets task result synchronously.

public static Result<TResult>? TryGetResult<TResult>(this Task<TResult> task)

Attempts to get the result of the task if it is completed.

public static Task<ValueTuple<Result<T1>, Result<T2>>> WhenAll<T1, T2>(Task<T1> task1, Task<T2> task2)

Creates a task that will complete when all of the passed tasks have completed.

public static Task<ValueTuple<Result<T1>, Result<T2>, Result<T3>>> WhenAll<T1, T2, T3>(Task<T1> task1, Task<T2> task2, Task<T3> task3)

Creates a task that will complete when all of the passed tasks have completed.

public static Task<ValueTuple<Result<T1>, Result<T2>, Result<T3>, Result<T4>>> WhenAll<T1, T2, T3, T4>(Task<T1> task1, Task<T2> task2, Task<T3> task3, Task<T4> task4)

Creates a task that will complete when all of the passed tasks have completed.

public static Task<ValueTuple<Result<T1>, Result<T2>, Result<T3>, Result<T4>, Result<T5>>> WhenAll<T1, T2, T3, T4, T5>(Task<T1> task1, Task<T2> task2, Task<T3> task3, Task<T4> task4, Task<T5> task5)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask WhenAll(ValueTask task1, ValueTask task2)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask<ValueTuple<Result<T1>, Result<T2>>> WhenAll<T1, T2>(ValueTask<T1> task1, ValueTask<T2> task2)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask WhenAll(ValueTask task1, ValueTask task2, ValueTask task3)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask<ValueTuple<Result<T1>, Result<T2>, Result<T3>>> WhenAll<T1, T2, T3>(ValueTask<T1> task1, ValueTask<T2> task2, ValueTask<T3> task3)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask WhenAll(ValueTask task1, ValueTask task2, ValueTask task3, ValueTask task4)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask<ValueTuple<Result<T1>, Result<T2>, Result<T3>, Result<T4>>> WhenAll<T1, T2, T3, T4>(ValueTask<T1> task1, ValueTask<T2> task2, ValueTask<T3> task3, ValueTask<T4> task4)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask WhenAll(ValueTask task1, ValueTask task2, ValueTask task3, ValueTask task4, ValueTask task5)

Creates a task that will complete when all of the passed tasks have completed.

public static ValueTask<ValueTuple<Result<T1>, Result<T2>, Result<T3>, Result<T4>, Result<T5>>> WhenAll<T1, T2, T3, T4, T5>(ValueTask<T1> task1, ValueTask<T2> task2, ValueTask<T3> task3, ValueTask<T4> task4, ValueTask<T5> task5)

Creates a task that will complete when all of the passed tasks have completed.