<?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>Co- and contra-variance (Lucian Wischik)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx</link><description>How do I convert an IEnumerable(Of CheckingAccount) into an IEnumerable(Of Account) ? (where CheckingAccount inherits from Account). 
 Currently this conversion isn't allowed, but we're considering a VB language feature to support it. The topic is called</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Co- and contra-variance (Lucian Wischik)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#10172516</link><pubDate>Wed, 08 Jun 2011 13:43:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10172516</guid><dc:creator>Xenon Headlights</dc:creator><description>&lt;p&gt;ok i will check the blog link, thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10172516" width="1" height="1"&gt;</description></item><item><title>Nouveautés de Visual Basic 2010 [VB10] : Générique Variance, Covariance, Contravariance</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#9404179</link><pubDate>Sat, 07 Feb 2009 12:33:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9404179</guid><dc:creator>RedoBlog - The .NET Gentleman !!!</dc:creator><description>&lt;p&gt;Nous voici quasiment au terme des nouveaut&amp;#233;s de Visual Basic 2010 (VB10). Abordons cette fois-ci la notion&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9404179" width="1" height="1"&gt;</description></item><item><title>VB 2010 Unveiled at PDC 2008! (Lisa Feigenbaum)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#9030454</link><pubDate>Mon, 03 Nov 2008 05:13:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9030454</guid><dc:creator>VB Feeds</dc:creator><description>&lt;p&gt;Last week at the Professional Developers Conference , we made a number of very exciting announcements&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9030454" width="1" height="1"&gt;</description></item><item><title>VB 2010 Unveiled at PDC 2008! (Lisa Feigenbaum)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#9029936</link><pubDate>Mon, 03 Nov 2008 03:19:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9029936</guid><dc:creator>The Visual Basic Team</dc:creator><description>&lt;p&gt;Last week at the Professional Developers Conference , we made a number of very exciting announcements&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9029936" width="1" height="1"&gt;</description></item><item><title>Generic Variance Part1 : Do you really need it ?</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#9008864</link><pubDate>Tue, 21 Oct 2008 10:10:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9008864</guid><dc:creator>VB Feeds</dc:creator><description>&lt;p&gt;Lucian has kicked off the conversation on generic variance in VB , so I thought I’d write a few posts&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9008864" width="1" height="1"&gt;</description></item><item><title>re: Co- and contra-variance (Lucian Wischik)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#8847715</link><pubDate>Mon, 11 Aug 2008 11:09:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8847715</guid><dc:creator>int19h</dc:creator><description>&lt;p&gt;It seems to me that declaration-site variance (as implemented in the CLR, and now proposed for C# and VB.NET) is less useful than call-site variance (as implemented in Java using wildcards). Here's why: stop for a moment and think, how many of BCL generic classes could actually be converted to use this feature? There's IEnumerable&amp;lt;T&amp;gt;, alright - but what else? ICollection&amp;lt;T&amp;gt; is right out, because it is IEnumerable&amp;lt;T&amp;gt; (and hence covariant), but it also takes T as an argument for Add() (which is contravariant) - the intersection of those is invariant. The same goes for all interfaces further extending ICollection&amp;lt;T&amp;gt;, such as IList&amp;lt;T&amp;gt;.&lt;/p&gt;
&lt;p&gt;On the other hand, with wildcards, I can deal with ICollection&amp;lt;T&amp;gt; either in covariant or contravariant fashion: for example, only using GetEnumerator() and Count - a typical real-world scenario - is covariant; only using Add() is contravariant. You can do this with declaration-site variance too, but you have to split every interface into its covariant and contravariant parts, and I doubt the BCL team would do it at this point; besides, it relies upon interface designers to do the right thing, and gives the user no recourse if they don't.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8847715" width="1" height="1"&gt;</description></item><item><title>Generic Variance Part1 : Do you really need it ?</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#8847470</link><pubDate>Mon, 11 Aug 2008 06:21:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8847470</guid><dc:creator>@ Head</dc:creator><description>&lt;p&gt;Lucian has kicked off the conversation on generic variance in VB , so I thought I’d write a few posts&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8847470" width="1" height="1"&gt;</description></item><item><title>re: Co- and contra-variance (Lucian Wischik)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#8842862</link><pubDate>Fri, 08 Aug 2008 11:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8842862</guid><dc:creator>Rik Hemsley</dc:creator><description>&lt;p&gt;Damien Guard came up with a solution to this:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://damieng.com/blog/2006/05/24/ienumerable_t_to_ienumerable_subclassoft"&gt;http://damieng.com/blog/2006/05/24/ienumerable_t_to_ienumerable_subclassoft&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=8842862" width="1" height="1"&gt;</description></item><item><title>re: Co- and contra-variance (Lucian Wischik)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#8842463</link><pubDate>Fri, 08 Aug 2008 08:51:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8842463</guid><dc:creator>Jeff Burt</dc:creator><description>&lt;p&gt;The easy way to do this at the moment is the following:&lt;/p&gt;
&lt;p&gt;&amp;lt;System.Runtime.CompilerServices.Extension()&amp;gt; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Function ToIEnumerable(Of T)(ByVal args As IEnumerable) As IEnumerable(Of T)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return (From item As Object In args Select DirectCast(item, T))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;Quick and simple. Your original code would just change to the following:&lt;/p&gt;
&lt;p&gt;Dim y = Expression.Call(instance, method, args.ToIEnumerable(Of Expression))&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8842463" width="1" height="1"&gt;</description></item><item><title>car insurance &amp;raquo; Co- and contra-variance (Lucian Wischik)</title><link>http://blogs.msdn.com/b/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx#8841778</link><pubDate>Fri, 08 Aug 2008 00:55:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8841778</guid><dc:creator>car insurance &amp;raquo; Co- and contra-variance (Lucian Wischik)</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://hoursfunnywallpaper.cn/?p=234"&gt;http://hoursfunnywallpaper.cn/?p=234&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8841778" width="1" height="1"&gt;</description></item></channel></rss>