@@ -39,7 +39,7 @@ static partial class IAsyncEnumerableExtensions
3939 /// </summary>
4040 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
4141 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
42- public static async Task < TSource [ ] > ToArrayAsync < TSource > ( this IAsyncEnumerable < TSource > source )
42+ public static async ValueTask < TSource [ ] > ToArrayAsync < TSource > ( this IAsyncEnumerable < TSource > source )
4343 => ( await ToListAsync ( source ) ) . ToArray ( ) ;
4444
4545 /// <summary>
@@ -48,7 +48,7 @@ public static async Task<TSource[]> ToArrayAsync<TSource>(this IAsyncEnumerable<
4848 /// </summary>
4949 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
5050 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
51- public static Task < Dictionary < TKey , TSource > > ToDictionaryAsync < TSource , TKey > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector ) where TKey : notnull
51+ public static ValueTask < Dictionary < TKey , TSource > > ToDictionaryAsync < TSource , TKey > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector ) where TKey : notnull
5252 => ToDictionaryAsync ( source , keySelector , x => x , null ) ;
5353
5454 /// <summary>
@@ -57,7 +57,7 @@ public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(t
5757 /// </summary>
5858 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
5959 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
60- public static Task < Dictionary < TKey , TSource > > ToDictionaryAsync < TSource , TKey > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector , IEqualityComparer < TKey > comparer ) where TKey : notnull
60+ public static ValueTask < Dictionary < TKey , TSource > > ToDictionaryAsync < TSource , TKey > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector , IEqualityComparer < TKey > comparer ) where TKey : notnull
6161 => ToDictionaryAsync ( source , keySelector , x => x , comparer ) ;
6262
6363 /// <summary>
@@ -66,7 +66,7 @@ public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(t
6666 /// </summary>
6767 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
6868 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
69- public static Task < Dictionary < TKey , TElement > > ToDictionaryAsync < TSource , TKey , TElement > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector , Func < TSource , TElement > elementSelector ) where TKey : notnull
69+ public static ValueTask < Dictionary < TKey , TElement > > ToDictionaryAsync < TSource , TKey , TElement > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector , Func < TSource , TElement > elementSelector ) where TKey : notnull
7070 => ToDictionaryAsync ( source , keySelector , elementSelector , null ) ;
7171
7272 /// <summary>
@@ -76,7 +76,7 @@ public static Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey,
7676 /// </summary>
7777 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
7878 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
79- public static async Task < Dictionary < TKey , TElement > > ToDictionaryAsync < TSource , TKey , TElement > (
79+ public static async ValueTask < Dictionary < TKey , TElement > > ToDictionaryAsync < TSource , TKey , TElement > (
8080 this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector ,
8181 Func < TSource , TElement > elementSelector , IEqualityComparer < TKey > ? comparer ) where TKey : notnull
8282 {
@@ -93,7 +93,7 @@ public static async Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource,
9393 /// </summary>
9494 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
9595 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
96- public static Task < HashSet < TSource > > ToHashSetAsync < TSource > ( this IAsyncEnumerable < TSource > source )
96+ public static ValueTask < HashSet < TSource > > ToHashSetAsync < TSource > ( this IAsyncEnumerable < TSource > source )
9797 => ToHashSetAsync ( source , null ) ;
9898
9999 /// <summary>
@@ -102,7 +102,7 @@ public static Task<HashSet<TSource>> ToHashSetAsync<TSource>(this IAsyncEnumerab
102102 /// </summary>
103103 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
104104 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
105- public static async Task < HashSet < TSource > > ToHashSetAsync < TSource > ( this IAsyncEnumerable < TSource > source , IEqualityComparer < TSource > ? comparer )
105+ public static async ValueTask < HashSet < TSource > > ToHashSetAsync < TSource > ( this IAsyncEnumerable < TSource > source , IEqualityComparer < TSource > ? comparer )
106106 {
107107 var set = new HashSet < TSource > ( comparer ) ;
108108 await foreach ( var item in source )
@@ -117,7 +117,7 @@ public static async Task<HashSet<TSource>> ToHashSetAsync<TSource>(this IAsyncEn
117117 /// </summary>
118118 /// <exception cref="ArgumentException">The <paramref name="source"/> does not implement
119119 /// <see cref="IAsyncEnumerable{T}"/>.</exception>
120- public static async Task < List < TSource > > ToListAsync < TSource > ( this IAsyncEnumerable < TSource > source )
120+ public static async ValueTask < List < TSource > > ToListAsync < TSource > ( this IAsyncEnumerable < TSource > source )
121121 {
122122 var list = new List < TSource > ( ) ;
123123 await foreach ( var item in source )
0 commit comments