7
7
8
8
namespace System . Threading . Tasks
9
9
{
10
- public static class AsyncEnumerableExtensions
10
+
11
+ // This type is only public for ref assms < .NET Standard 2.1 and implementations
12
+ #if ! BCL_HAS_CONFIGUREAWAIT || ! REFERENCE_ASSEMBLY
13
+ public
14
+ #else
15
+ internal
16
+ #endif
17
+ static class AsyncEnumerableExtensions
11
18
{
12
19
#if ! BCL_HAS_CONFIGUREAWAIT // https://github.com/dotnet/coreclr/pull/21939
13
20
@@ -37,8 +44,9 @@ public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(
37
44
new ConfiguredCancelableAsyncEnumerable < T > ( source , continueOnCapturedContext : true , cancellationToken ) ;
38
45
39
46
40
- #elif ! REFERENCE_ASSEMBLY
41
- // we need to carry an impl that delegates to the BCL version of these
47
+ #else
48
+ // we need to carry an impl that delegates to the BCL version of these in the lib
49
+ // They won't be in the ref
42
50
43
51
/// <summary>Configures how awaits on the tasks returned from an async disposable will be performed.</summary>
44
52
/// <param name="source">The source async disposable.</param>
@@ -65,35 +73,6 @@ public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(
65
73
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
66
74
public static ConfiguredCancelableAsyncEnumerable < T > WithCancellation < T > (
67
75
this IAsyncEnumerable < T > source , CancellationToken cancellationToken ) => TaskExtensions . WithCancellation ( source , cancellationToken ) ;
68
-
69
- #else
70
- // Reference assembly, these won't be emitted, but keep these internal so we can compile
71
-
72
- /// <summary>Configures how awaits on the tasks returned from an async disposable will be performed.</summary>
73
- /// <param name="source">The source async disposable.</param>
74
- /// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
75
- /// <returns>The configured async disposable.</returns>
76
- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
77
- internal static ConfiguredAsyncDisposable ConfigureAwait ( this IAsyncDisposable source , bool continueOnCapturedContext ) =>
78
- TaskExtensions . ConfigureAwait ( source , continueOnCapturedContext ) ;
79
-
80
- /// <summary>Configures how awaits on the tasks returned from an async iteration will be performed.</summary>
81
- /// <typeparam name="T">The type of the objects being iterated.</typeparam>
82
- /// <param name="source">The source enumerable being iterated.</param>
83
- /// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
84
- /// <returns>The configured enumerable.</returns>
85
- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
86
- internal static ConfiguredCancelableAsyncEnumerable < T > ConfigureAwait < T > (
87
- this IAsyncEnumerable < T > source , bool continueOnCapturedContext ) => TaskExtensions . ConfigureAwait ( source , continueOnCapturedContext ) ;
88
-
89
- /// <summary>Sets the <see cref="CancellationToken"/> to be passed to <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator(CancellationToken)"/> when iterating.</summary>
90
- /// <typeparam name="T">The type of the objects being iterated.</typeparam>
91
- /// <param name="source">The source enumerable being iterated.</param>
92
- /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param>
93
- /// <returns>The configured enumerable.</returns>
94
- [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
95
- internal static ConfiguredCancelableAsyncEnumerable < T > WithCancellation < T > (
96
- this IAsyncEnumerable < T > source , CancellationToken cancellationToken ) => TaskExtensions . WithCancellation ( source , cancellationToken ) ;
97
76
#endif
98
77
}
99
78
}
0 commit comments