Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing docs for Task API #107951

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6265,6 +6265,7 @@ public static Task<TResult[]> WhenAll<TResult>(IEnumerable<Task<TResult>> tasks)
/// <summary>
/// Creates a task that will complete when all of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of all of the supplied tasks.</returns>
/// <remarks>
Expand Down Expand Up @@ -6305,6 +6306,7 @@ public static Task<TResult[]> WhenAll<TResult>(params Task<TResult>[] tasks)
/// <summary>
/// Creates a task that will complete when all of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of all of the supplied tasks.</returns>
/// <remarks>
Expand Down Expand Up @@ -6679,6 +6681,7 @@ public static Task<Task> WhenAny(IEnumerable<Task> tasks) =>
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TTask">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed.</returns>
/// <remarks>
Expand Down Expand Up @@ -6753,6 +6756,7 @@ private static Task<TTask> WhenAny<TTask>(IEnumerable<TTask> tasks) where TTask
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed.</returns>
/// <remarks>
Expand All @@ -6775,6 +6779,7 @@ public static Task<Task<TResult>> WhenAny<TResult>(params Task<TResult>[] tasks)
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed.</returns>
/// <remarks>
Expand All @@ -6788,6 +6793,7 @@ public static Task<Task<TResult>> WhenAny<TResult>(params ReadOnlySpan<Task<TRes
WhenAnyCore(tasks);

/// <summary>Creates a task that will complete when either of the supplied tasks have completed.</summary>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="task1">The first task to wait on for completion.</param>
/// <param name="task2">The second task to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed.</returns>
Expand All @@ -6804,6 +6810,7 @@ public static Task<Task<TResult>> WhenAny<TResult>(Task<TResult> task1, Task<TRe
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed.</returns>
/// <remarks>
Expand Down Expand Up @@ -6837,25 +6844,33 @@ public static IAsyncEnumerable<Task> WhenEach(params Task[] tasks)
}

/// <inheritdoc cref="WhenEach(Task[])"/>
/// <param name="tasks">The tasks to iterate through as they complete.</param>
public static IAsyncEnumerable<Task> WhenEach(ReadOnlySpan<Task> tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params
ericstj marked this conversation as resolved.
Show resolved Hide resolved
WhenEachState.Iterate<Task>(WhenEachState.Create(tasks));

/// <inheritdoc cref="WhenEach(Task[])"/>
/// <param name="tasks">The tasks to iterate through as they complete.</param>
public static IAsyncEnumerable<Task> WhenEach(IEnumerable<Task> tasks) =>
WhenEachState.Iterate<Task>(WhenEachState.Create(tasks));

/// <inheritdoc cref="WhenEach(Task[])"/>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to iterate through as they complete.</param>
public static IAsyncEnumerable<Task<TResult>> WhenEach<TResult>(params Task<TResult>[] tasks)
{
ArgumentNullException.ThrowIfNull(tasks);
return WhenEach((ReadOnlySpan<Task<TResult>>)tasks);
}

/// <inheritdoc cref="WhenEach(Task[])"/>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to iterate through as they complete.</param>
public static IAsyncEnumerable<Task<TResult>> WhenEach<TResult>(ReadOnlySpan<Task<TResult>> tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params
WhenEachState.Iterate<Task<TResult>>(WhenEachState.Create(ReadOnlySpan<Task>.CastUp(tasks)));

/// <inheritdoc cref="WhenEach(Task[])"/>
/// <typeparam name="TResult">The type of the result returned by the tasks.</typeparam>
/// <param name="tasks">The tasks to iterate through as they complete.</param>
public static IAsyncEnumerable<Task<TResult>> WhenEach<TResult>(IEnumerable<Task<TResult>> tasks) =>
WhenEachState.Iterate<Task<TResult>>(WhenEachState.Create(tasks));

Expand Down
Loading