Ver código fonte

Implement IsEmpty directly.

Bart De Smet 6 anos atrás
pai
commit
89ec92be8b

+ 4 - 1
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/IsEmpty.cs

@@ -19,7 +19,10 @@ namespace System.Linq
 
             static async Task<bool> Core(IAsyncEnumerable<TSource> _source, CancellationToken _cancellationToken)
             {
-                return !await _source.AnyAsync(_cancellationToken).ConfigureAwait(false);
+                await using (var e = _source.GetAsyncEnumerator(_cancellationToken).ConfigureAwait(false))
+                {
+                    return !await e.MoveNextAsync();
+                }
             }
         }
     }