using System;
using System.Collections.Generic;
namespace DuckTyping
{
class Collection
public Enumerator GetEnumerator()
return new Enumerator();
}
class Enumerator
private int _current=0;
public object Current
get { return "Enumerator.Current "+_current.ToString(); }
public bool MoveNext()
_current++;
if (_current>10) return false;
return true;
public class Program
public static void Main()
foreach(object o in new Collection())
Console.WriteLine(o);