| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
using System; |
| 3 |
using System.Threading.Tasks; |
| 4 |
using System.Threading; |
| 5 |
|
| 6 |
namespace System.Collections.Generic |
| 7 |
{ |
| 8 |
/// <summary> |
| 9 |
/// Asynchronous version of the IEnumerator<T> interface, allowing elements to be |
| 10 |
/// retrieved asynchronously. |
| 11 |
/// </summary> |
| 12 |
/// <typeparam name="T">Element type.</typeparam> |
| 13 |
public interface IAsyncEnumerator< |
| 14 |
#if !NO_VARIANCE |
| 15 |
out |
| 16 |
#endif |
| 17 |
T> : IDisposable |
| 18 |
{ |
| 19 |
/// <summary> |
| 20 |
/// Advances the enumerator to the next element in the sequence, returning the result asynchronously. |
| 21 |
/// </summary> |
| 22 |
/// <param name="cancellationToken">Cancellation token that can be used to cancel the operation.</param> |
| 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 |
Task<bool> MoveNext(CancellationToken cancellationToken); |
| 28 |
|
| 29 |
/// <summary> |
| 30 |
/// Gets the current element in the iteration. |
| 31 |
/// </summary> |
| 32 |
T Current { get; } |
| 33 |
} |
| 34 |
} |