using System; using System.Collections.Generic; class MyList : IEnumerable { public IEnumerator GetEnumerator () { yield break; } } struct Foo { public readonly T Data; public Foo (T data) { this.Data = data; } } class X { static void Main () { MyList> list = new MyList > (); foreach (Foo foo in list) ; } }