| 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.Linq; |
| 4 |
using System.Threading.Tasks; |
| 5 |
using System.Threading; |
| 6 |
|
| 7 |
namespace System.Collections.Generic |
| 8 |
{ |
| 9 |
public static class AsyncEnumerator |
| 10 |
{ |
| 11 |
/// <summary> |
| 12 |
/// Advances the enumerator to the next element in the sequence, returning the result asynchronously. |
| 13 |
/// </summary> |
| 14 |
/// <returns> |
| 15 |
/// Task containing the result of the operation: true if the enumerator was successfully advanced |
| 16 |
/// to the next element; false if the enumerator has passed the end of the sequence. |
| 17 |
/// </returns> |
| 18 |
public static Task<bool> MoveNext<T>(this IAsyncEnumerator<T> enumerator) |
| 19 |
{ |
| 20 |
if (enumerator == null) |
| 21 |
throw new ArgumentNullException("enumerator"); |
| 22 |
|
| 23 |
return enumerator.MoveNext(CancellationToken.None); |
| 24 |
} |
| 25 |
} |
| 26 |
} |