<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Matt Manela's Blog : WHAT!</title><link>http://blogs.msdn.com/matt/archive/tags/WHAT_2100_/default.aspx</link><description>Tags: WHAT!</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Foreach is Duck Typed!</title><link>http://blogs.msdn.com/matt/archive/2008/07/22/foreach-is-duck-typed.aspx</link><pubDate>Tue, 22 Jul 2008 20:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8764433</guid><dc:creator>MattManela</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/matt/comments/8764433.aspx</comments><wfw:commentRss>http://blogs.msdn.com/matt/commentrss.aspx?PostID=8764433</wfw:commentRss><description>&lt;P&gt;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.&amp;nbsp; And if so it will call MoveNext and Current to loop over the elements.&amp;nbsp; But then I read this:&lt;/P&gt;
&lt;P&gt;&lt;A title=http://blogs.msdn.com/kcwalina/archive/2007/07/18/DuckNotation.aspx href="http://blogs.msdn.com/kcwalina/archive/2007/07/18/DuckNotation.aspx" mce_href="http://blogs.msdn.com/kcwalina/archive/2007/07/18/DuckNotation.aspx"&gt;http://blogs.msdn.com/kcwalina/archive/2007/07/18/DuckNotation.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In that post Krzysztof reveals that in reality implementation of those interfaces are NOT checked.&amp;nbsp; In fact, it uses duck typing to determine if iteration can occur.&amp;nbsp; The compiler will just look for a method that matches a certain signature and use that.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Very interesting!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8764433" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/matt/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/matt/archive/tags/Programming/default.aspx">Programming</category><category domain="http://blogs.msdn.com/matt/archive/tags/WHAT_2100_/default.aspx">WHAT!</category></item></channel></rss>