Как сбросить экземпляр IEnumerator в нижнем регистре? (E.Reset() бросает NotImplementedException)Как сбросить экземпляр IEnumerator в нижнем регистре
void Main()
{
IEnumerator<string> e = new List<string> { "a", "b", "c" }.Select(o => o).GetEnumerator();
while(e.MoveNext())
{
Console.WriteLine(e.Current);
}
if(
//some condition
)
{
e.Reset();
while(e.MoveNext())
{
//Do something else with e.Current
}
}
}
также: [Почему метод Reset() на классе Enumerator должен бросить NotSupportedException()?] (Http://stackoverflow.com/questions/1468170/why-the-reset-method-on-enumerator- класс обязательно бросьте-A-NotSupportedException) – sloth