File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,21 @@ public static IAsyncEnumerable<TSource> IgnoreElements<TSource>(this IAsyncEnume
1616 if ( source == null )
1717 throw Error . ArgumentNull ( nameof ( source ) ) ;
1818
19+ #if USE_ASYNC_ITERATOR
20+ return Create ( Core ) ;
21+
22+ async IAsyncEnumerator < TSource > Core ( CancellationToken cancellationToken )
23+ {
24+ await foreach ( var _ in source . WithCancellation ( cancellationToken ) . ConfigureAwait ( false ) )
25+ {
26+ }
27+ }
28+ #else
1929 return new IgnoreElementsAsyncIterator < TSource > ( source ) ;
30+ #endif
2031 }
2132
33+ #if ! USE_ASYNC_ITERATOR
2234 private sealed class IgnoreElementsAsyncIterator < TSource > : AsyncIterator < TSource >
2335 {
2436 private readonly IAsyncEnumerable < TSource > _source ;
@@ -69,4 +81,5 @@ protected override async ValueTask<bool> MoveNextCore()
6981 }
7082 }
7183 }
84+ #endif
7285}
You can’t perform that action at this time.
0 commit comments