<?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>Multimethods in C# 4.0 with 'dynamic'</title><link>http://blogs.msdn.com/b/laurionb/archive/2009/08/13/multimethods-in-c-4-0-with-dynamic.aspx</link><description>(Continuing from the post on implementing the Visitor pattern in C# 4.0) 
 A virtual method is polymorphic in one dimension (the runtime class of the object the method is attached to). Multimethods (multiple dispatch) are polymorphic in multiple dimensions</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Multimethods in C# 4.0 with 'dynamic'</title><link>http://blogs.msdn.com/b/laurionb/archive/2009/08/13/multimethods-in-c-4-0-with-dynamic.aspx#10081787</link><pubDate>Wed, 27 Oct 2010 22:24:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10081787</guid><dc:creator>Nate</dc:creator><description>&lt;p&gt;nikitazu - What you&amp;#39;re missing is that the implementation methods are named CollideWithImpl, not CollideWith. If all of the methods had the same name then you would be correct. However, there is only one CollideWith method and it&amp;#39;s defined for the base class Thing.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10081787" width="1" height="1"&gt;</description></item><item><title>re: Multimethods in C# 4.0 with 'dynamic'</title><link>http://blogs.msdn.com/b/laurionb/archive/2009/08/13/multimethods-in-c-4-0-with-dynamic.aspx#9946172</link><pubDate>Sat, 09 Jan 2010 22:28:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9946172</guid><dc:creator>nikitazu</dc:creator><description>&lt;p&gt;Correct me if I'm wrong, but is it really a dynamic dispatch?&lt;/p&gt;
&lt;p&gt;in this example:&lt;/p&gt;
&lt;p&gt;var asteroid = new Asteroid();&lt;/p&gt;
&lt;p&gt;var spaceship = new Spaceship();&lt;/p&gt;
&lt;p&gt;CollideWith(asteroid, spaceship);&lt;/p&gt;
&lt;p&gt;CollideWith(spaceship, spaceship);&lt;/p&gt;
&lt;p&gt;overloads&lt;/p&gt;
&lt;p&gt;CollideWith(Asteroid x, Spaceship y) &lt;/p&gt;
&lt;p&gt;CollideWith(Spaceship x, Spaceship y)&lt;/p&gt;
&lt;p&gt;are called directly, and&lt;/p&gt;
&lt;p&gt;CollideWith(Thing x, Thing y)&lt;/p&gt;
&lt;p&gt;is never invoked&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9946172" width="1" height="1"&gt;</description></item><item><title>re: Multimethods in C# 4.0 with 'dynamic'</title><link>http://blogs.msdn.com/b/laurionb/archive/2009/08/13/multimethods-in-c-4-0-with-dynamic.aspx#9879105</link><pubDate>Fri, 21 Aug 2009 21:54:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9879105</guid><dc:creator>Laurion Burchall</dc:creator><description>&lt;p&gt;Good point about the recursion. Using the same name is cute, but can easily lead to those problems. (Making Thing abstract would prevent this specific problem but leave the door open for future occurences).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9879105" width="1" height="1"&gt;</description></item><item><title>re: Multimethods in C# 4.0 with 'dynamic'</title><link>http://blogs.msdn.com/b/laurionb/archive/2009/08/13/multimethods-in-c-4-0-with-dynamic.aspx#9875596</link><pubDate>Wed, 19 Aug 2009 17:43:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9875596</guid><dc:creator>richard_deeming</dc:creator><description>&lt;p&gt;Nice - but wouldn't it be better to use a different method name to avoid infinite recursion?&lt;/p&gt;
&lt;p&gt;var x = new Thing();&lt;/p&gt;
&lt;p&gt;var y = new Thing();&lt;/p&gt;
&lt;p&gt;CollideWith(x, y);&lt;/p&gt;
&lt;p&gt;or:&lt;/p&gt;
&lt;p&gt;var x = new Asteroid();&lt;/p&gt;
&lt;p&gt;var y = new Thing();&lt;/p&gt;
&lt;p&gt;CollideWith(x, y);&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9875596" width="1" height="1"&gt;</description></item></channel></rss>