3 ms·
Interestingly, this sort of structural typing was already present in C# 1.0 with the foreach statement allowing anything with a GetEnumerator() method that retu
by mgdlbp 5y ago
Interestingly, this sort of structural typing was already present in C# 1.0 with the foreach statement allowing anything with a GetEnumerator() method that returns something that looks like an IEnumerator.
This was discussed in 2011 in a StackOverflow question [0], including a link to a blog post by one of the language designers [1].
[0] https://stackoverflow.com/questions/6368967/duck-typing-in-the-c-sharp-compiler https://stackoverflow.com/questions/6368967/duck-typing-in-t...
[1] https://web.archive.org/web/20120126033827/http://blogs.msdn.com/b/ericlippert/archive/2011/06/30/following-the-pattern.aspx https://web.archive.org/web/20120126033827/http://blogs.msdn...