<?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>Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx</link><description>This is the 5th installment in my series of posts about extension methods. You can find links to the rest of the series here . Originally I had planned on discussing extension method versioning issues, but I've decided to postpone that topic to my next</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>url</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#7273271</link><pubDate>Mon, 28 Jan 2008 01:33:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7273271</guid><dc:creator>url</dc:creator><description>&lt;p&gt;url website home domain &lt;a rel="nofollow" target="_new" href="http://latoniawarford.00me.com/"&gt;http://latoniawarford.00me.com/&lt;/a&gt; url&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7273271" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1750839</link><pubDate>Sat, 24 Feb 2007 07:38:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1750839</guid><dc:creator>Anthony D. Green, MCPD</dc:creator><description>&lt;p&gt;I think the big question is whether all those sucky Shared methods on Array, Enum, and Char will ever be callable using intuitive instance method conventions. It is for this reason alone I would almost welcome the idea of the consumer deciding whether to us extension methods. Sometimes class library writers, God bless them, just overlook little tiny features of usability.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1750839" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1748804</link><pubDate>Fri, 23 Feb 2007 22:28:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1748804</guid><dc:creator>Reinier Post</dc:creator><description>&lt;p&gt;The functionality of this feature will really help me.&lt;/p&gt;
&lt;p&gt;But I wonder about two design decisions.&lt;/p&gt;
&lt;p&gt;1) Extension method definitions are explicitly labeled as such.&lt;/p&gt;
&lt;p&gt;This forces the person who provides a utility method, i.e. any Public Shared method with arguments, to explicitly decide, at the time the method is coded, whether it will be available as an extension method. &amp;nbsp;It is not clear to me whether this is the right place and time to make that judgment.&lt;/p&gt;
&lt;p&gt;Moreover, I do not see why the decision has to be made in the first place. &amp;nbsp;Why not simply regard *any* Shared method as an extension method on the type of its first argument? &amp;nbsp;That way, even pre-existing Shared methods (of which there are quite a few) will be extension methods.&lt;/p&gt;
&lt;p&gt;I'm sure there are arguments against it, but I can't think of any. &amp;nbsp;Will there be far too many extension methods for the developer to deal with? &amp;nbsp;Doesn't seem likely. &amp;nbsp;If there are, is it too difficult to provide filtering facilities? &amp;nbsp;I'm not sure.&lt;/p&gt;
&lt;p&gt;2) Extension method calls are *not* explicitly labeled as such.&lt;/p&gt;
&lt;p&gt;This series discusses how the semantics of extension method calls is subtly different from normal method calls, and it points out that name clashes between the two types are silently resolved in favor of normal methods. &amp;nbsp;There appears to be a potential risk of confusion for the developer here. &amp;nbsp;One easy resolution is to make extension method calls syntactically distinct from normal method calls, e.g. by using @methodname(args) instead of&lt;/p&gt;
&lt;p&gt;.methodname(args).&lt;/p&gt;
&lt;p&gt;Again, I feel I can't really see beyond this single observation, and the VB team must have some pros and cons in mind that I'm overlooking.&lt;/p&gt;
&lt;p&gt;Would you care to share some of your thinking regarding these two points?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1748804" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1746982</link><pubDate>Fri, 23 Feb 2007 16:05:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1746982</guid><dc:creator>Ian Horwill</dc:creator><description>&lt;p&gt;Excellent post. This is type of info that can be hard to come by but which allows a much deeper understanding of what's going on. Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1746982" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1739991</link><pubDate>Thu, 22 Feb 2007 10:53:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1739991</guid><dc:creator>Nicola</dc:creator><description>&lt;p&gt;I hope that Orcas will support non base zero arrays and other very cool stuff of the glorious VB6 like the object Shape.&lt;/p&gt;
&lt;p&gt;Ciao&lt;/p&gt;
&lt;p&gt;Nicola&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1739991" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1691552</link><pubDate>Sat, 17 Feb 2007 00:49:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1691552</guid><dc:creator>VBTeam</dc:creator><description>&lt;p&gt;Tony,&lt;/p&gt;
&lt;p&gt;Thanks for your feedback. We probably will not be able to make a change like this for Orcas,&lt;/p&gt;
&lt;p&gt;but I will forward your request over to our langauge design team for consideration in a &lt;/p&gt;
&lt;p&gt;future version of the product. &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;-Scott&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1691552" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1690760</link><pubDate>Fri, 16 Feb 2007 22:15:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1690760</guid><dc:creator>tony_hild</dc:creator><description>&lt;p&gt;I would like to see a keyword or something like c# 'this' modifier instead ExtensionMethod attribute. It's annoying have to imports the System.Runtime.CompilerServices namespace and writing the attribute.&lt;/p&gt;
&lt;p&gt;I guess that would be easy for the compiler to do this. A 'Extension' keyword would be like the 'Shared' keyword.&lt;/p&gt;
&lt;p&gt;Ex.:&lt;/p&gt;
&lt;p&gt;Public Extension Sub Times(ByVal x As Integer, ByVal d As DelegateSub)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;For i = 1 To x&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;d()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;Public Extension Function AddValue(ByVal x As Integer, ByVal y as Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Return x + y&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;p&gt;or &lt;/p&gt;
&lt;p&gt;Public Function AddValue(ByVal Me x As Integer, ByVal y as Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Return x + y&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;p&gt;Tony&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1690760" width="1" height="1"&gt;</description></item><item><title>re: Extension methods and Generics (Extension Methods Part 5)</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1686284</link><pubDate>Fri, 16 Feb 2007 03:34:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1686284</guid><dc:creator>Roger Jennings</dc:creator><description>&lt;p&gt;Pingback from &lt;a rel="nofollow" target="_new" href="http://oakleafblog.blogspot.com/2007/02/vb-9-extension-methods-documentation.html"&gt;http://oakleafblog.blogspot.com/2007/02/vb-9-extension-methods-documentation.html&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1686284" width="1" height="1"&gt;</description></item><item><title>The Visual Basic Team : Articles about Extension Methods</title><link>http://blogs.msdn.com/b/vbteam/archive/2007/02/15/extension-methods-and-generics-extension-methods-part-5.aspx#1685921</link><pubDate>Fri, 16 Feb 2007 01:08:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1685921</guid><dc:creator>The Visual Basic Team : Articles about Extension Methods</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/vbteam/pages/articles-about-extension-methods.aspx"&gt;http://blogs.msdn.com/vbteam/pages/articles-about-extension-methods.aspx&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1685921" width="1" height="1"&gt;</description></item></channel></rss>