using System.Collections;
using System.Collections.Generic;
var coll = new MyCollection<string>(new []{
"I", "love", "my", "instructor"
foreach(string s in coll)
class MyCollection<T> : IEnumerable<T>
public MyCollection(T [] src)
elems = new T[src.Length];
for(int i = 0; i != src.Length; ++i)
class En : IEnumerator<T>
public T Current => elems[cur];
object IEnumerator.Current => elems[cur];
if(cur == elems.Length - 1) return false;
public IEnumerator<T> GetEnumerator() => new En(elems);
IEnumerator IEnumerable.GetEnumerator() => new En(elems);