17 using System.Collections;
18 using System.Collections.Generic;
29 private List<T> _buffer;
30 private IEnumerator<T> _enumerator;
45 _enumerator = enumerable.GetEnumerator();
59 if (_enumerator !=
null)
61 while (_enumerator.MoveNext())
63 yield
return _enumerator.Current;
67 _enumerator.Dispose();
76 _buffer =
new List<T>();
80 while (i <= _buffer.Count)
86 if (_enumerator !=
null && i >= _buffer.Count)
88 if (_enumerator.MoveNext())
90 var value = _enumerator.Current;
97 _enumerator.Dispose();
104 if (_buffer.Count > i)
106 yield
return _buffer[i];
124 IEnumerator IEnumerable.GetEnumerator()