17 using System.Collections.Generic;
29 public static IEnumerator<T>
Where<T>(
this IEnumerator<T> enumerator, Func<T, bool> predicate)
33 while (enumerator.MoveNext())
35 if (predicate(enumerator.Current))
37 yield
return enumerator.Current;
46 public static IEnumerator<TResult>
Select<T, TResult>(
this IEnumerator<T> enumerator, Func<T, TResult> selector)
50 while (enumerator.MoveNext())
52 yield
return selector(enumerator.Current);
60 public static IEnumerator<TResult>
SelectMany<T, TResult>(
this IEnumerator<T> enumerator, Func<T, IEnumerator<TResult>> selector)
64 while (enumerator.MoveNext())
66 using (var inner = selector(enumerator.Current))
68 while (inner.MoveNext())
70 yield
return inner.Current;