From 5b9ddc5a61f181d916d01cfaf0233ea4cde0fad2 Mon Sep 17 00:00:00 2001 From: doomchild Date: Fri, 26 Jul 2024 10:12:26 -0500 Subject: [PATCH] Issue-74: Return IReadOnlyList from Partition closes #74 SemVer:Minor --- src/TaskExtras.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TaskExtras.cs b/src/TaskExtras.cs index d406080..4d415ce 100644 --- a/src/TaskExtras.cs +++ b/src/TaskExtras.cs @@ -195,13 +195,13 @@ private static Task DoRetry( /// The underlying type of the tasks in . /// The collection of tasks to partition. /// A tuple of the partitioned tasks. - public static Task<(IEnumerable> Faulted, IEnumerable> Fulfilled)> Partition( + public static Task<(IReadOnlyList> Faulted, IReadOnlyList> Fulfilled)> Partition( IEnumerable> tasks ) { - return tasks.Aggregate, Task<(IEnumerable> Faulted, IEnumerable> Fulfilled)>>( - Task.FromResult(((IEnumerable>)new List>(), (IEnumerable>)new List>())), - ZipTasksWith> Faulted, IEnumerable> Fulfilled), (IEnumerable> Faulted, IEnumerable> Fulfilled), Exception> + return tasks.Aggregate, Task<(IReadOnlyList> Faulted, IReadOnlyList> Fulfilled)>>( + Task.FromResult(((IReadOnlyList>)new List>(), (IReadOnlyList>)new List>())), + ZipTasksWith> Faulted, IReadOnlyList> Fulfilled), (IReadOnlyList> Faulted, IReadOnlyList> Fulfilled), Exception> ( (values, v) => (values.Faulted, values.Fulfilled.Append(Task.FromResult(v)).ToList()), (values, v) => (values.Faulted.Append>(Task.FromException(v)).ToList(), values.Fulfilled)