IAsyncEnumerator.cs 1.1 KB

123456789101112131415161718192021222324252627282930
  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. using System.Threading.Tasks;
  5. namespace System.Collections.Generic
  6. {
  7. /// <summary>
  8. /// Asynchronous version of the IEnumerator&lt;T&gt; interface, allowing elements to be
  9. /// retrieved asynchronously.
  10. /// </summary>
  11. /// <typeparam name="T">Element type.</typeparam>
  12. public interface IAsyncEnumerator<out T> : IDisposable
  13. {
  14. /// <summary>
  15. /// Gets the current element in the iteration.
  16. /// </summary>
  17. T Current { get; }
  18. /// <summary>
  19. /// Advances the enumerator to the next element in the sequence, returning the result asynchronously.
  20. /// </summary>
  21. /// <returns>
  22. /// Task containing the result of the operation: true if the enumerator was successfully advanced
  23. /// to the next element; false if the enumerator has passed the end of the sequence.
  24. /// </returns>
  25. Task<bool> MoveNextAsync();
  26. }
  27. }