IAsyncEnumerator.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. // See https://github.com/dotnet/csharplang/blob/master/proposals/async-streams.md for the definition of this interface
  5. // and the design rationale. (8/30/2017)
  6. #if !HAS_ASYNCENUMERABLE
  7. using System.Threading.Tasks;
  8. namespace System.Collections.Generic
  9. {
  10. /// <summary>
  11. /// Asynchronous version of the <see cref="IEnumerator{T}"/> interface, allowing elements to be retrieved asynchronously.
  12. /// </summary>
  13. /// <typeparam name="T">Element type.</typeparam>
  14. public interface IAsyncEnumerator<out T> : IAsyncDisposable
  15. {
  16. /// <summary>
  17. /// Gets the current element in the iteration.
  18. /// </summary>
  19. T Current { get; }
  20. /// <summary>
  21. /// Advances the enumerator to the next element in the sequence, returning the result asynchronously.
  22. /// </summary>
  23. /// <returns>
  24. /// Task containing the result of the operation: true if the enumerator was successfully advanced
  25. /// to the next element; false if the enumerator has passed the end of the sequence.
  26. /// </returns>
  27. ValueTask<bool> MoveNextAsync();
  28. }
  29. }
  30. #endif