|
@@ -69,9 +69,15 @@ namespace System.Linq
|
|
|
if (selector == null)
|
|
|
throw Error.ArgumentNull(nameof(selector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
var index = -1;
|
|
|
|
|
@@ -99,9 +105,15 @@ namespace System.Linq
|
|
|
if (selector == null)
|
|
|
throw Error.ArgumentNull(nameof(selector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
var index = -1;
|
|
|
|
|
@@ -130,9 +142,15 @@ namespace System.Linq
|
|
|
if (selector == null)
|
|
|
throw Error.ArgumentNull(nameof(selector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
var index = -1;
|
|
|
|
|
@@ -174,9 +192,15 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false))
|
|
|
{
|
|
@@ -199,9 +223,15 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false))
|
|
|
{
|
|
@@ -225,9 +255,15 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
await foreach (var element in source.WithCancellation(cancellationToken).ConfigureAwait(false))
|
|
|
{
|
|
@@ -262,9 +298,15 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
var index = -1;
|
|
|
|
|
@@ -294,9 +336,15 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
var index = -1;
|
|
|
|
|
@@ -327,9 +375,15 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
+#if HAS_ASYNC_ENUMERABLE_CANCELLATION
|
|
|
+ return Core();
|
|
|
+
|
|
|
+ async IAsyncEnumerable<TResult> Core([System.Runtime.CompilerServices.EnumeratorCancellation]CancellationToken cancellationToken = default)
|
|
|
+#else
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
|
+#endif
|
|
|
{
|
|
|
var index = -1;
|
|
|
|