summaryrefslogtreecommitdiff
path: root/external/rx/Ix/NET/System.Interactive.Async/IAsyncEnumerator.cs
blob: 72cfdbc61d3424b4f7778ef18107d1cebee15ace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using System.Threading;

namespace System.Collections.Generic
{
    /// <summary>
    /// Asynchronous version of the IEnumerator&lt;T&gt; interface, allowing elements to be
    /// retrieved asynchronously.
    /// </summary>
    /// <typeparam name="T">Element type.</typeparam>
    public interface IAsyncEnumerator<
#if DESKTOPCLR40 || SILVERLIGHT4
        out
#endif
        T> : IDisposable
    {
        /// <summary>
        /// Advances the enumerator to the next element in the sequence, returning the result asynchronously.
        /// </summary>
        /// <param name="cancellationToken">Cancellation token that can be used to cancel the operation.</param>
        /// <returns>
        /// Task containing the result of the operation: true if the enumerator was successfully advanced 
        /// to the next element; false if the enumerator has passed the end of the sequence.
        /// </returns>
        Task<bool> MoveNext(CancellationToken cancellationToken);

        /// <summary>
        /// Gets the current element in the iteration.
        /// </summary>
        T Current { get; }
    }
}