I thought I know how the foreach construct worked under the covers. I figured the compiler would check if the type being iterated over implement IEnumerable or IEnumerator. And if so it will call MoveNext and Current to loop over the elements. But then I read this:
In that post Krzysztof reveals that in reality implementation of those interfaces are NOT checked. In fact, it uses duck typing to determine if iteration can occur. The compiler will just look for a method that matches a certain signature and use that.