From dc35f24f528dd821db67245a0c24e613afae5d5e Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Tue, 17 Sep 2024 14:22:39 -0700 Subject: [PATCH 1/2] Add missing docs for Task API --- .../src/System/Threading/Tasks/Task.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index a6acc125c038b..fdfab5701bd10 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -6265,6 +6265,7 @@ public static Task WhenAll(IEnumerable> tasks) /// /// Creates a task that will complete when all of the supplied tasks have completed. /// + /// The type of the result returned by the tasks. /// The tasks to wait on for completion. /// A task that represents the completion of all of the supplied tasks. /// @@ -6305,6 +6306,7 @@ public static Task WhenAll(params Task[] tasks) /// /// Creates a task that will complete when all of the supplied tasks have completed. /// + /// The type of the result returned by the tasks. /// The tasks to wait on for completion. /// A task that represents the completion of all of the supplied tasks. /// @@ -6679,6 +6681,7 @@ public static Task WhenAny(IEnumerable tasks) => /// /// Creates a task that will complete when any of the supplied tasks have completed. /// + /// The type of the result returned by the tasks. /// The tasks to wait on for completion. /// A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed. /// @@ -6753,6 +6756,7 @@ private static Task WhenAny(IEnumerable tasks) where TTask /// /// Creates a task that will complete when any of the supplied tasks have completed. /// + /// The type of the result returned by the tasks. /// The tasks to wait on for completion. /// A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed. /// @@ -6775,6 +6779,7 @@ public static Task> WhenAny(params Task[] tasks) /// /// Creates a task that will complete when any of the supplied tasks have completed. /// + /// The type of the result returned by the tasks. /// The tasks to wait on for completion. /// A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed. /// @@ -6788,6 +6793,7 @@ public static Task> WhenAny(params ReadOnlySpanCreates a task that will complete when either of the supplied tasks have completed. + /// The type of the result returned by the tasks. /// The first task to wait on for completion. /// The second task to wait on for completion. /// A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed. @@ -6804,6 +6810,7 @@ public static Task> WhenAny(Task task1, Task /// Creates a task that will complete when any of the supplied tasks have completed. /// + /// The type of the result returned by the tasks. /// The tasks to wait on for completion. /// A task that represents the completion of one of the supplied tasks. The return Task's Result is the task that completed. /// @@ -6837,14 +6844,18 @@ public static IAsyncEnumerable WhenEach(params Task[] tasks) } /// + /// The task to iterate through when completed. public static IAsyncEnumerable WhenEach(ReadOnlySpan tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params WhenEachState.Iterate(WhenEachState.Create(tasks)); /// + /// The task to iterate through when completed. public static IAsyncEnumerable WhenEach(IEnumerable tasks) => WhenEachState.Iterate(WhenEachState.Create(tasks)); /// + /// The type of the result returned by the tasks. + /// The task to iterate through when completed. public static IAsyncEnumerable> WhenEach(params Task[] tasks) { ArgumentNullException.ThrowIfNull(tasks); @@ -6852,10 +6863,14 @@ public static IAsyncEnumerable> WhenEach(params Task + /// The type of the result returned by the tasks. + /// The task to iterate through when completed. public static IAsyncEnumerable> WhenEach(ReadOnlySpan> tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params WhenEachState.Iterate>(WhenEachState.Create(ReadOnlySpan.CastUp(tasks))); /// + /// The type of the result returned by the tasks. + /// The task to iterate through when completed. public static IAsyncEnumerable> WhenEach(IEnumerable> tasks) => WhenEachState.Iterate>(WhenEachState.Create(tasks)); From 410fb6a87eaad9d860ae21d392972e2e18004674 Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Tue, 17 Sep 2024 14:40:36 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Stephen Toub --- .../src/System/Threading/Tasks/Task.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index fdfab5701bd10..ab5c875d0918b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -6844,18 +6844,18 @@ public static IAsyncEnumerable WhenEach(params Task[] tasks) } /// - /// The task to iterate through when completed. + /// The tasks to iterate through as they complete. public static IAsyncEnumerable WhenEach(ReadOnlySpan tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params WhenEachState.Iterate(WhenEachState.Create(tasks)); /// - /// The task to iterate through when completed. + /// The tasks to iterate through as they complete. public static IAsyncEnumerable WhenEach(IEnumerable tasks) => WhenEachState.Iterate(WhenEachState.Create(tasks)); /// /// The type of the result returned by the tasks. - /// The task to iterate through when completed. + /// The tasks to iterate through as they complete. public static IAsyncEnumerable> WhenEach(params Task[] tasks) { ArgumentNullException.ThrowIfNull(tasks); @@ -6864,13 +6864,13 @@ public static IAsyncEnumerable> WhenEach(params Task /// The type of the result returned by the tasks. - /// The task to iterate through when completed. + /// The tasks to iterate through as they complete. public static IAsyncEnumerable> WhenEach(ReadOnlySpan> tasks) => // TODO https://github.com/dotnet/runtime/issues/77873: Add params WhenEachState.Iterate>(WhenEachState.Create(ReadOnlySpan.CastUp(tasks))); /// /// The type of the result returned by the tasks. - /// The task to iterate through when completed. + /// The tasks to iterate through as they complete. public static IAsyncEnumerable> WhenEach(IEnumerable> tasks) => WhenEachState.Iterate>(WhenEachState.Create(tasks));