class SimpleEnumerable<T> : IEnumerable<T> //, IEnumerable { private T[] _items; public SimpleEnumerable(T[] items) { _items = items; } IEnumerator<T> IEnumerable<T>.GetEnumerator() { foreach (var item in _items) { yield return item; } } public IEnumerator GetEnumerator() { foreach (var item in _items) { yield return item; } } }
214200cookie-checkC# basic enumerable implementation with yield