With Java Iterator
s, I have used the hasNext
method to determine whether an iteration has more elements (without consuming an element) -- thus, hasNext
is like a "Peek
" method.
My question: is there anything like a "hasNext
" or "Peek
" method with C#'s generic IEnumerator
s?
No, unfortunately there isn't.
The IEnumerator<T>
interface only exposes the following members:
Methods:
Dispose
MoveNext
Reset
Properties:
Current