IAsyncEnumerator.cs 1.3 KB

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