<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>@ Head : CSharp</title><link>http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx</link><description>Tags: CSharp</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Saving and transferring customisations</title><link>http://msmvps.com/blogs/bill/archive/2009/11/25/saving-and-transferring-customisations.aspx</link><pubDate>Wed, 25 Nov 2009 03:54:10 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1742064</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1742064</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/11/25/saving-and-transferring-customisations.aspx#comments</comments><description>&lt;p&gt;I got an email from a reader last week asking about saving customisations in Visual Studio:&lt;/p&gt;  &lt;blockquote style="color:#7f7f7f;"&gt;   &lt;p&gt;Hi Bill&lt;/p&gt;    &lt;p&gt;I read an excellent article by you&lt;/p&gt;    &lt;p&gt;&lt;a href="http://visualstudiomagazine.com/Articles/2007/12/01/Customize-the-VB-IDE.aspx?Page=1"&gt;http://visualstudiomagazine.com/Articles/2007/12/01/Customize-the-VB-IDE.aspx?Page=1&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Just wondering if you know of a way to export those customisations so I can set up my computer at work restore after HDD fails and share my favorite settings with friends.&lt;/p&gt;    &lt;p&gt;Also would like to do same for my VBIDE customisations&lt;/p&gt;    &lt;p&gt;I have googled to no avail...... :-/ &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well the good news is this is incredibly easy. On the Tools menu in Visual Studio you should see the “&lt;strong&gt;Import and Export Savings . . &lt;/strong&gt;.” command.&amp;#160; You can choose what groups of settings to import or export.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1742064" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VSM/default.aspx">VSM</category><category domain="http://msmvps.com/blogs/bill/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>IntPtr gets operators !!!</title><link>http://msmvps.com/blogs/bill/archive/2009/11/05/intptr-gets-operators.aspx</link><pubDate>Thu, 05 Nov 2009 01:48:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1737714</guid><dc:creator>bill</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1737714</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/11/05/intptr-gets-operators.aspx#comments</comments><description>&lt;p&gt;This seems so incredibly long overdue, but at last as of .NET 4, IntPtr has + and – operators added to it !!&lt;/p&gt;  &lt;p&gt;This means you can now easily write code such as :&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Dim ptr As IntPtr &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; . . . .   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ptr += 4&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;this is great when dealing with offsets etc.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The actual implementation is kind of interesting. Here I’m seeing&amp;#160; the implementation as :&lt;/p&gt;  &lt;p&gt;&lt;font color="#4d6886"&gt;Public Shared &lt;b&gt;Operator&lt;/b&gt; &lt;b&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IntPtr/op_Subtraction(IntPtr,Int32):IntPtr"&gt;-&lt;/a&gt;&lt;/b&gt;(ByVal &lt;b&gt;pointer&lt;/b&gt; As &lt;/font&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IntPtr"&gt;&lt;font color="#4d6886"&gt;IntPtr&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt;, ByVal &lt;b&gt;offset&lt;/b&gt; As &lt;/font&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Int32"&gt;&lt;font color="#4d6886"&gt;Integer&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt;) As &lt;/font&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IntPtr"&gt;&lt;font color="#4d6886"&gt;IntPtr&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Return New &lt;/font&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IntPtr/.ctor(Int32)"&gt;&lt;font color="#4d6886"&gt;IntPtr&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt;((&lt;/font&gt;&lt;a&gt;&lt;font color="#4d6886"&gt;pointer&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt;.&lt;/font&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IntPtr/ToInt32():Int32"&gt;&lt;font color="#4d6886"&gt;ToInt32&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt; - &lt;/font&gt;&lt;a&gt;&lt;font color="#4d6886"&gt;offset&lt;/font&gt;&lt;/a&gt;&lt;font color="#4d6886"&gt;))      &lt;br /&gt;End Function&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I guess this is because it is the 32 bit version of the library. Hopefully in the 64 bit version it calls on IntPtr.ToInt64 ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1737714" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category></item><item><title>Updates on the Snippet Editor</title><link>http://msmvps.com/blogs/bill/archive/2009/09/03/updates-on-the-snippet-editor.aspx</link><pubDate>Thu, 03 Sep 2009 01:03:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1720398</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1720398</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/09/03/updates-on-the-snippet-editor.aspx#comments</comments><description>&lt;p&gt;First the good news :&lt;/p&gt;  &lt;p&gt;The February release of the &lt;a href="http://billmccarthy.com/Projects/Snippet_Editor/default.html"&gt;Snippet Editor&lt;/a&gt; has now had &lt;strong&gt;10,000&lt;/strong&gt; downloads !&lt;/p&gt;  &lt;p&gt;Now for bug fix news:&lt;/p&gt;  &lt;p&gt;There were a couple of issues with the paths per language.&amp;#160; A problem with Express Editions of Visual Studio occurred due to partial entries in the registry I didn’t for-see. Initial design and testing was done with full versions of Visual Studio, but I want to ensure that it does work with the express versions, that’s why the tool is standalone not an add-in.&amp;#160; So the good news is I have fixed those bugs (I think).&amp;#160; &lt;/p&gt;  &lt;p&gt;If you want those fixes you can use the original source from Feb and just &lt;a href="http://snippeteditor.codeplex.com/SourceControl/changeset/view/36425#391917"&gt;download the updated products.vb&lt;/a&gt; file. I’ll probably look at rolling this up into a new release in the not to distant future.&lt;/p&gt;  &lt;p&gt;Enjoy :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1720398" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/XML/default.aspx">XML</category></item><item><title>Is C# unacceptable ?</title><link>http://msmvps.com/blogs/bill/archive/2009/09/03/is-c-unacceptable.aspx</link><pubDate>Thu, 03 Sep 2009 00:50:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1720397</guid><dc:creator>bill</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1720397</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/09/03/is-c-unacceptable.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;span style="font-size:small;"&gt;Well if you mark your methods as being &lt;strong&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;void&lt;/span&gt;&lt;/strong&gt; from the outset &amp;hellip;&amp;hellip;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1720397" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Rant/default.aspx">Rant</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Iterators: a flag for simplification ?</title><link>http://msmvps.com/blogs/bill/archive/2009/04/21/iterators-a-flag-for-simplification.aspx</link><pubDate>Tue, 21 Apr 2009 02:02:16 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1689277</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1689277</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/04/21/iterators-a-flag-for-simplification.aspx#comments</comments><description>&lt;p&gt;A couple of months ago &lt;a href="http://msmvps.com/blogs/bill/archive/2009/02/02/iterators-in-vb-10.aspx" target="_blank"&gt;I blogged about iterators in VB&lt;/a&gt; (or the lack there-of), and pointed folks to &lt;a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2972" target="_blank"&gt;an article I wrote for Visual Studio magazine that provides snippets and templates to help with iterators in VB&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;One of the things I talk about in that article is often the use of iterators in C# code that I have seen is superfulous, especially given the LINQ libraries.&amp;#160; Yesterday I read &lt;a href="http://weblogs.asp.net/davidmccollough/archive/2009/04/19/covariant-generic-list.aspx" target="_blank"&gt;another example of this where the developer(s) had written a custom iterator instead of using a LINQ query&lt;/a&gt;. Their code required the defining of a generic class:     &lt;br /&gt;&lt;/p&gt;    &lt;blockquote&gt;     &lt;pre&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; EnumerableGeneric&amp;lt;TClass, TInterface&amp;gt; 
              : IEnumerable&amp;lt;TInterface&amp;gt; where TClass : TInterface
{
   &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; IList&amp;lt;TClass&amp;gt; list;

   &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; EnumerableGeneric(IList&amp;lt;TClass&amp;gt; list)
   {
      &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.list = list;
   }

   &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; IEnumerator&amp;lt;TInterface&amp;gt; GetEnumerator()
   {
      &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (TClass item &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; list)
      {
         yield &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; item;
      }
   }

   IEnumerator IEnumerable.GetEnumerator()
   {
      &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.GetEnumerator();
   }
}&lt;/pre&gt;
  &lt;/blockquote&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And the example of using this required the calling code to instantiate an instance of this class:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

  &lt;blockquote&gt;
    &lt;pre&gt;MyMethod(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; EnumerableGeneric&amp;lt;ClassA, IClassInterface&amp;gt;(caInstance));&lt;/pre&gt;
  &lt;/blockquote&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;A simpler alternative is to actually use LINQ, eg:&lt;/p&gt;

&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MyMethod(caInstance.Cast&amp;lt;IClassInterface&amp;gt;());&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;In VB talk I think it’s even more natural flowing: 
  &lt;br /&gt;

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; MyMethod(caInstance.Cast(Of IClassInterface))&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;It is in places like that I like the (Of T) syntax of VB a lot better, but some folks prefer a Cup&amp;lt;T&amp;gt; to a Cup(Of T)&amp;#160; .&amp;#160; The key point here is the use of “yield return” in C# is a good indicator that the code can often be replaced with far simpler LINQ constructs that reduce your LOC’s, and hence reduce your debugging and maintenance loads.&amp;#160; There will of course be times where there isn’t a simple LINQ replacement, but if you do ever come across custom iterators, do take pause to think about using LINQ.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1689277" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>String.IsNullOrEmpty : update on that nasty null reference exception</title><link>http://msmvps.com/blogs/bill/archive/2009/03/10/string-isnullorempty-update-on-that-nasty-null-reference-exception.aspx</link><pubDate>Tue, 10 Mar 2009 12:08:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1677289</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1677289</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/03/10/string-isnullorempty-update-on-that-nasty-null-reference-exception.aspx#comments</comments><description>&lt;p&gt;Back in April 2006, &lt;a href="http://msmvps.com/blogs/bill/archive/2006/04/04/89234.aspx" target="_blank"&gt;I blogged about a nasty JIT compiler optimisation&lt;/a&gt; that would cause String.IsNullOrEmpty to throw a null reference exception;&amp;#160; ironic really given that is the very thing you’d use the IsNullOrEmpty method to check against.&amp;#160; Well since then, due to popular demand on the connect site, this bug has been fixed in .NET 2.0 SP1 (which implies .NET 3.0 and 3.5)&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://msmvps.com/kb/940900/"&gt;&lt;em&gt;940900&lt;/em&gt;&lt;/a&gt;&lt;em&gt; (http://support.microsoft.com/kb/940900/ ) FIX: You receive the NullReferenceException exception when you call the String.IsNullOrEmpty function in an application that is built on the .NET Framework 2.0&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1677289" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Bug/default.aspx">Bug</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>When ….</title><link>http://msmvps.com/blogs/bill/archive/2009/02/21/when.aspx</link><pubDate>Sat, 21 Feb 2009 01:56:52 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1673043</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1673043</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/02/21/when.aspx#comments</comments><description>&lt;p&gt;VB has a lot of high level features other .Net languages, in particular C# don’t.&amp;#160; Sadly these are often overlooked by some developers because other languages like C# don’t have them – the lowest common denominator syndrome.&amp;#160; This is sad because many of these features are actually part of the .NET runtime.&amp;#160; For example, VB has full interface mapping, C# has only a limited form of interface mapping they call explicit interface implementation which for them relies on a&amp;#160; constrained naming pattern.&amp;#160; Another example is custom events in VB, where VB provides the full encapsulation the CIL provides: being the Add, Remove and Raise for the event. (C# doesn’t support the Raise or Fire).&amp;#160; The most obvious example would have to be Optional parameters. For years the C# brethren dismissed them as evil and in C# 4.0 now tout them as their amazing new feature they’ve added ;)&lt;/p&gt;  &lt;p&gt;Another rarely spoken of feature that VB and the .NET runtime support are exception filters … the When clause.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;Read why you should use When in the CLR team’s blog:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/clrteam/archive/2009/02/05/catch-rethrow-and-filters-why-you-should-care.aspx" href="http://blogs.msdn.com/clrteam/archive/2009/02/05/catch-rethrow-and-filters-why-you-should-care.aspx"&gt;http://blogs.msdn.com/clrteam/archive/2009/02/05/catch-rethrow-and-filters-why-you-should-care.aspx&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1673043" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Snippet Editor 2.1 screen-cast</title><link>http://msmvps.com/blogs/bill/archive/2009/02/05/snippet-editor-2-1-screen-cast.aspx</link><pubDate>Thu, 05 Feb 2009 09:08:31 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1669250</guid><dc:creator>bill</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1669250</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/02/05/snippet-editor-2-1-screen-cast.aspx#comments</comments><description>&lt;p&gt;I’ve just uploaded a new screen cast:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://billmccarthy.com/Projects/Snippet_Editor/screencast.html" target="_blank"&gt;Snippet Editor Tips and Tricks&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Enjoy :)&lt;/p&gt;  &lt;p&gt;(oh and don’t forget the “&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=2895732" target="_blank"&gt;buy me a beer&lt;/a&gt;” button)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1669250" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/XML/default.aspx">XML</category></item><item><title>New release of Snippet Editor</title><link>http://msmvps.com/blogs/bill/archive/2009/02/04/new-release-of-snippet-editor.aspx</link><pubDate>Tue, 03 Feb 2009 17:31:38 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1668548</guid><dc:creator>bill</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1668548</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/02/04/new-release-of-snippet-editor.aspx#comments</comments><description>&lt;p&gt;Snippet Editor 2.1 is now released on codeplex:    &lt;br /&gt;&lt;a title="http://www.codeplex.com/SnippetEditor" href="http://www.codeplex.com/SnippetEditor"&gt;http://www.codeplex.com/SnippetEditor&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Apart from the few minor bug fixes, it includes improved search and now support for Visual Studio 2010 as well as 2008 and 2005.&lt;/p&gt;  &lt;p&gt;I’ve also added a “buy me a beer” button to this blog, and on the codeplex site, so if you like the Snippet Editor you can help put a smile on my face :) &lt;/p&gt;  &lt;p&gt;&lt;a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;amp;hosted_button_id=2895732"&gt;&lt;img title="donate" alt="donate" src="http://msmvps.com/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill/bymeabeer.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The snippet editor remains free: no advertisements, no nag screens.&amp;#160; &lt;/p&gt;  &lt;p&gt;yep, free as in beer ;)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Enjoy :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1668548" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/XML/default.aspx">XML</category></item><item><title>Iterators in VB 10 ?</title><link>http://msmvps.com/blogs/bill/archive/2009/02/02/iterators-in-vb-10.aspx</link><pubDate>Mon, 02 Feb 2009 13:56:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1668151</guid><dc:creator>bill</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1668151</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/02/02/iterators-in-vb-10.aspx#comments</comments><description>&lt;p&gt;Although VB 10 won’t have a formal syntax for iterators, it will have all the necessary ingredients to easily write iterators. In VB10 you can use a generic template and multi line lambdas to create iterators. &lt;/p&gt;  &lt;p&gt;This iterator in C# :&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt; static public IEnumerable&amp;lt;String&amp;gt; Lines( this TextReader rdr)      &lt;br /&gt;{       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; String line;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; while ((line = rdr.ReadLine()) != null)&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; yield return line;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Can be written as this in VB10:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre&gt;&lt;font face="Trebuchet MS"&gt;&amp;lt;Extension()&amp;gt; &lt;/font&gt;&lt;br /&gt;Public Function Lines(ByVal rdr as TextReader) As IEnumerable(Of String)&lt;/pre&gt;

  &lt;pre&gt;     Return New GenericIterator(Of String) 
          (&lt;strong&gt;Function(ByRef nextItem As String) As Boolean
              nextItem = rdr.ReadLine
              Return nextItem IsNot Nothing
           End Function)&lt;/strong&gt;&lt;/pre&gt;

  &lt;pre&gt;End Function&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The above code uses a generic iterator class that accepts a lambda function. The lambda function sets the Current item of the iterator and returns True if MoveNext should be True. The above example is written as an extension method, but you can also use the inner part of the function inline.&lt;/p&gt;

&lt;p&gt;For more on using iterators in VB 9 today, as well as the generic class for the above example, see &lt;a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2972" target="_blank"&gt;my latest article in Visual Studio Magazine .&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1668151" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VSM/default.aspx">VSM</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category></item><item><title>Snippet Editor is now on CodePlex</title><link>http://msmvps.com/blogs/bill/archive/2008/12/28/snippet-editor-is-now-on-codeplex.aspx</link><pubDate>Sun, 28 Dec 2008 09:13:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1657880</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1657880</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/12/28/snippet-editor-is-now-on-codeplex.aspx#comments</comments><description>&lt;p&gt;I’ve just finished uploading the Snippet Editor to CodePlex&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/SnippetEditor" href="http://www.codeplex.com/SnippetEditor"&gt;http://www.codeplex.com/SnippetEditor&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It includes some minor bug fixes from the previous release.&lt;/p&gt;  &lt;p&gt;Enjoy :)&lt;/p&gt;  &lt;p&gt;And Merry XMas :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1657880" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category></item><item><title>VB Snippet Editor</title><link>http://msmvps.com/blogs/bill/archive/2008/12/08/vb-snippet-editor.aspx</link><pubDate>Mon, 08 Dec 2008 11:42:02 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1656158</guid><dc:creator>bill</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1656158</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/12/08/vb-snippet-editor.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Over the last week I’ve got a sudden influx of emails about the Snippet Editor.&amp;#160; I’m figuring this is stemming from &lt;a href="http://blogs.msdn.com/vbteam/archive/2008/12/07/did-you-know-there-are-many-ways-to-insert-a-snippet-into-your-code-lisa-feigenbaum.aspx" target="_blank"&gt;Lisa’s recent blog entry&lt;/a&gt; and her &lt;a href="http://blogs.msdn.com/vbteam/archive/2008/12/06/video-microsoft-visual-basic-2008-tips-and-tricks-lisa-feigenbaum.aspx" target="_blank"&gt;tips and trips for VS 2008 presentation&lt;/a&gt; :)&amp;#160; &lt;/p&gt;  &lt;p&gt;Some of the emails have been really nice praise, folks wanting to add some features, a bug on XP 64 (which unfortunately is about the only OS I don’t have in my testing suite), and some general questions around snippets.&amp;#160; So I gave this lots of thought and decided to put up a site on CodePlex. This will allow people to add features, work together on bugs, and share discussions around snippets including future directions for the snippet editor.&lt;/p&gt;  &lt;p&gt;The new codeplex site will be at &lt;a title="http://www.codeplex.com/SnippetEditor" href="http://www.codeplex.com/SnippetEditor"&gt;http://www.codeplex.com/SnippetEditor&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It’s not ready yet, and will probably be a week while I get all the bits together and ensure there’s no rude words in the code comments etc ;)&amp;#160; I was hesitant about moving to CodePlex as I was really disappointed how gotdotnet was just closed down and not migrated. And I should add here a word of caution for those in charge should CodePlex go a similar route.. I will travel the continents and track you down and when I find you stare at you for a really long time until you feel uncomfortable !!&amp;#160; ;)&amp;#160; (Seriously, please don’t close codeplex)&lt;/p&gt;  &lt;p&gt;So, all going well, the Snippet Editor will be on CodePlex this time next week.&amp;#160; I’ll make sure to post when it’s ready and redirect my current site there.&amp;#160; Any suggestions on the open&amp;#160; source license eula etc most welcome.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1656158" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category></item><item><title>What we have here is a failure to communicate</title><link>http://msmvps.com/blogs/bill/archive/2008/11/14/what-we-have-here-is-a-failure-to-communicate.aspx</link><pubDate>Fri, 14 Nov 2008 02:33:49 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1654086</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1654086</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/11/14/what-we-have-here-is-a-failure-to-communicate.aspx#comments</comments><description>&lt;p&gt;you can tell from the title there’s a Friday rant coming can’t you ?&amp;#160; Well yeh, sometimes what should be a simple task of writing code becomes painstakingly slow.&amp;#160; Take for example this one line of code:&lt;/p&gt;  &lt;div style="font-size:11pt;background:white;color:black;font-family:consolas;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:#3092b1;"&gt;Dim&lt;/span&gt; doc = XDocument.Load(&lt;span style="background:#feffea;color:#a31515;"&gt;&amp;quot;abc.xml&amp;quot;&lt;/span&gt;)&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now if you like to write robust code, somewhere in your mind there should be that voice saying, “&lt;em&gt;ah but what if the file is not there or can’t be opened or isn’t valid xml&lt;/em&gt; “…etc, etc.&amp;#160; So the first thing you probably think of doing is look at what exceptions the method can throw,&amp;#160; or so you’d hope.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 1&lt;/strong&gt;. VB doesn’t display the exception information from any xml documentation.&amp;#160; Our first failure to communicate that then leads us on a great chase.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 2&lt;/strong&gt;. Who ever wrote the XDocument.Load method actually failed to provide the exception documentation. The Load method calls external methods such as XMLReader.Create and the exceptions from that are unchecked, allowed to bubble through. The documentation should indicate an include statement to say the XMLReader.Create exceptions bubble up.&amp;#160; The author(s) of XDocument.Load failed to communicate the exceptions that could be thrown.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 3.&lt;/strong&gt; If you like to keep current and have installed the SilverLight 2.0 SDK, F1 help will take you to a SilverLight topic even if you are writing a Console application.&amp;#160; That little voice in your head that first said “&lt;em&gt;what if&lt;/em&gt; …” is now screaming.&amp;#160; There’s a failure to communicate between Visual Studio and MSDN help.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 4.&lt;/strong&gt; Your only resolve is to do the lookup in msdn help yourself, only to find the documentation has no exception information because it relies on the xml documentation (see Problem 2).&amp;#160;&amp;#160; The failure to communicate cascades.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem 5.&lt;/strong&gt; As a last ditch desperate measure you use Reflector and walk through the code. Thankfully in this case the code is reasonably simple. The problem now is how do you get that information back into your code, so as you handle the correct exceptions ? This isn’t Relector’s fault as such, as the same problem exists if you do find the exception information in Visual Studio’s object browser. This is a failure to interact, but it can result in you not handling exceptions or documenting which exceptions bubble up from your methods, causing your code to fail to communicate. (see Problem 2.)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If religious wars were still in fashion, we’d be saying “hey what about checked exceptions al la Java ?”.&amp;#160; The more I am frustrated at how hard it is to write &lt;strong&gt;robust&lt;/strong&gt; code because of these often cascading failures to communicate, the more I want to sign up with the holly sect for checked exceptions.&lt;/p&gt;  &lt;p&gt;An alternative is to provide rich tooling and analysis.&amp;#160; Some years ago, myself and Geoff Appleby with some help from Mark Miller wrote a plug-in for refactor that did a look up based on the code you selected. It would match the method calls with their xml documentation, refine and sort the list based on inheritance rules (most specific first), and let you choose which ones to add to your code.&amp;#160; It really was simple once you got the method info, which is where refactor (or more accurately DXCore) came in. Unfortunately we hosted that project on the now defunct GotDotNet site :(&lt;/p&gt;  &lt;p&gt;Such a tool helps break the cycle here, but such a tool also needs to be used by Microsoft (see Problem 2 above), and there needs to be analysis to ensure exceptions are either handled or the documentation says what exceptions can be thrown. Writing robust code needs to be easier: we cannot just ignore exceptions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1654086" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Rant/default.aspx">Rant</category><category domain="http://msmvps.com/blogs/bill/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>What does VB 10 have ?</title><link>http://msmvps.com/blogs/bill/archive/2008/11/12/what-does-vb-10-have.aspx</link><pubDate>Wed, 12 Nov 2008 01:18:10 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1653804</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1653804</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/11/12/what-does-vb-10-have.aspx#comments</comments><description>&lt;p&gt;To answer what is in VB 10, have a &lt;a href="http://code.msdn.microsoft.com/vbfuture" target="_blank"&gt;look at the document on the vb futures site&lt;/a&gt;.&amp;#160; Basically the list is removal for the need of the line continuation character in many places, collection and array initializers, multi statement lambdas, and generic variance.&lt;/p&gt;  &lt;p&gt;I decided to look back at my brief wish lists for VB10&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/05/vb-10-thoughts.aspx" target="_blank"&gt;VB 10 thoughts Part 1&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/05/vb-10-thoughts-part-2.aspx" target="_blank"&gt;VB 10 thoughts Part 2&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/06/vb-10-thoughts-part-3.aspx" target="_blank"&gt;VB 10 thoughts Part 3&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/09/vb-10-thoughts-part-4.aspx" target="_blank"&gt;VB 10 thoughts Part 4&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/10/vb-10-thoughts-part-5.aspx" target="_blank"&gt;VB 10 thoughts Part 5&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/11/vb-10-thoughts-part-6.aspx" target="_blank"&gt;VB 10 thoughts Part 6&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/12/vb-10-thoughts-part-7.aspx" target="_blank"&gt;VB 10 thoughts Part 7&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/12/vb-10-thoughts-part-8.aspx" target="_blank"&gt;VB 10 thoughts Part 8&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/16/vb-10-thoughts-part-9.aspx" target="_blank"&gt;VB 10 thoughts Part 9&lt;/a&gt;     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Seems I did very poorly.&amp;#160; The only match I got was &lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/05/vb-10-thoughts.aspx" target="_blank"&gt;number 6&lt;/a&gt; multi statement lambdas. I should have had generic variance in the list considering that’s something I wanted since I first saw .NET generics&amp;#160; although that really is a framework thing not a language thing. The continuation character, collection and array initializers all seem nice, but functionally trivial to void.&amp;#160; Ironically, C#. which has many of those things on my list also picked up a couple it didn’t such as dynamic and they implemented optional parameters as they should be.&amp;#160; I must admit that hurts, especially as the optional parameters issues was &lt;a href="http://msmvps.com/blogs/bill/archive/2007/10/05/vb-10-thoughts.aspx" target="_blank"&gt;my #1&lt;/a&gt; item.&lt;/p&gt;  &lt;p&gt;For some reason in this new era of supposed language parity, I feel short changed :(&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1653804" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category></item><item><title>.NET 3.5 SP1 source code</title><link>http://msmvps.com/blogs/bill/archive/2008/09/12/net-3-5-sp1-source-code.aspx</link><pubDate>Thu, 11 Sep 2008 15:36:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1647492</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1647492</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/09/12/net-3-5-sp1-source-code.aspx#comments</comments><description>&lt;p&gt;When Visual Studio 2008 SP1 was released it didn’t have the source code for the framework like the original version of 2008 had. Well now it has !!&amp;#160; Actually &lt;a href="http://blogs.msdn.com/rscc/archive/2008/08/28/net-framework-3-5-sp1-sources-are-available.aspx" target="_blank"&gt;it was released almost two weeks ago&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1647492" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Unsubscribing events: How VB Handles it</title><link>http://msmvps.com/blogs/bill/archive/2008/08/21/unsubscribing-events-how-vb-handles-it.aspx</link><pubDate>Thu, 21 Aug 2008 11:40:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1645354</guid><dc:creator>bill</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1645354</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/08/21/unsubscribing-events-how-vb-handles-it.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://davybrion.com/blog/2008/08/why-you-should-always-unscubscribe-event-handlers/" target="_blank"&gt;Davy Brion posted&lt;/a&gt; about how events can keep object references alive.&amp;#160; In C# to rid yourself of this issue you have to manually unwire any event handler you wired.&amp;#160; In VB, it is a lot easier, all you have to do is use WithEvents and set the variable to nothing. This code is the VB version of Davy’s sample:&lt;/p&gt;  &lt;div style="font-size:11pt;background:white;color:black;font-family:consolas;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Class&lt;/span&gt; Publisher&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Event&lt;/span&gt; MyEvent &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; EventHandler&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt; FireEvent()&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;RaiseEvent&lt;/span&gt; MyEvent(&lt;span style="color:#3092b1;"&gt;Me&lt;/span&gt;, EventArgs.Empty)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Class&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Class&lt;/span&gt; GoodSubscriber&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Implements&lt;/span&gt; IDisposable&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Private&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;WithEvents&lt;/span&gt; _publisher &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; Publisher&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;New&lt;/span&gt;(&lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; publisher &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; Publisher)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _publisher = publisher&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Private&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt; _publisher_MyEvent(&lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Object&lt;/span&gt;, &lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color:#3092b1;"&gt;Handles&lt;/span&gt; _publisher.MyEvent&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&lt;span style="background:#feffea;color:#a31515;"&gt;&amp;quot;the publisher notified the good subscriber of an event&amp;quot;&lt;/span&gt;)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt; Dispose() &lt;span style="color:#3092b1;"&gt;Implements&lt;/span&gt; IDisposable.Dispose&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _publisher = &lt;span style="color:#3092b1;"&gt;Nothing&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Sub&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Class&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#3092b1;"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#3092b1;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;As long as the variable is declared as WithEvents any event wired up via declarative event handling will be unwired when the variable is set to Nothing.&lt;/p&gt;  &lt;p&gt;This is yet another subtle but important example of how declarative coding styles can lead to more robust code.&amp;#160; The above example is minimal, but when you get many events and many objects raising events, the cleanness of the VB way of handling it becomes even more important.&amp;#160; Or in other words in C# you have to make sure you unwire each and every event, in VB you use declarative events syntax and VB handles it for you ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1645354" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>VS 2008 SP1 Now available to MSDN subscribers</title><link>http://msmvps.com/blogs/bill/archive/2008/08/12/vs-2008-sp1-now-available-to-msdn-subscribers.aspx</link><pubDate>Mon, 11 Aug 2008 15:10:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1644245</guid><dc:creator>bill</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1644245</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/08/12/vs-2008-sp1-now-available-to-msdn-subscribers.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://msdn.microsoft.com/subscriptions/default.aspx" target="_blank"&gt;Check out the msdn subscriber homepage&lt;/a&gt;.&amp;#160; S&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;P1 for Visual Studio 2008 English is about 830 MB… downloading at present&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;:)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Then I can install SQL 2008 :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1644245" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Generic Variance Part1 : Do you really need it ?</title><link>http://msmvps.com/blogs/bill/archive/2008/08/11/generic-variance-part1-do-you-really-need-it.aspx</link><pubDate>Mon, 11 Aug 2008 03:21:25 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1644183</guid><dc:creator>bill</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1644183</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/08/11/generic-variance-part1-do-you-really-need-it.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/vbteam/archive/2008/08/07/co-and-contra-variance-lucian-wischik.aspx" target="_blank"&gt;Lucian has kicked off the conversation on generic variance in VB&lt;/a&gt; , so I thought I’d write a few posts outlining my perspectives on the subject… the first of which is this one, and what better place to start than to question whether or not it is really needed……&lt;/p&gt; &lt;p&gt;Generics came to .NET &lt;strong&gt;&lt;em&gt;after&lt;/em&gt;&lt;/strong&gt; the base framework and languages were implemented.&amp;nbsp; It was very much a bolt-on approach.&amp;nbsp; As such there was and still is an impedance mismatch between conventional concepts of polymorphism and generics. &lt;a href="http://msmvps.com/blogs/bill/archive/2007/11/05/oh-so-you-want-polymorphism.aspx" target="_blank"&gt;As I posted previously&lt;/a&gt;, I had raised this is issue with Anders and other language experts back at the 2003 PDC (at which time Anders suggested using a language other than VB or C# &amp;lt;g&amp;gt;). Fast forward to today, and this issue is now being looked at, but now I find myself questioning if it is really needed, or is the fault the mismatch of the original framework.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Let’s take Lucian’s example :&lt;/p&gt; &lt;p&gt;Dim args As New List(Of ConstantExpression)&lt;br /&gt;args.Add(Expression.Constant(2))&lt;br /&gt;args.Add(Expression.Constant(3))&lt;br /&gt;Dim y = Expression.Call(instance, method, &lt;u&gt;&lt;strong&gt;args&lt;/strong&gt;&lt;/u&gt;) &lt;p&gt;&amp;nbsp; &lt;p&gt;This code fails because the Call method is defined as : &lt;p&gt;&amp;nbsp; &lt;div style="font-size:11pt;background:white;color:black;font-family:consolas;"&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Shared&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Function&lt;/span&gt; [Call](&lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; instance &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; Expression, _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; method &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; MethodInfo, _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; arguments &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; IEnumerable(&lt;span style="color:#3092b1;"&gt;Of&lt;/span&gt; Expression)) _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; MethodCallExpression&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp; &lt;p&gt;But if it was defined as follows then the code would work:
&lt;p&gt;&amp;nbsp; &lt;div style="font-size:11pt;background:white;color:black;font-family:consolas;"&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Shared&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Function&lt;/span&gt; [Call](&lt;span style="color:#3092b1;"&gt;Of&lt;/span&gt; T &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; Expression) _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; instance &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; Expression, _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; method &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; MethodInfo, _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;ByVal&lt;/span&gt; arguments &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; IEnumerable(&lt;span style="color:#3092b1;"&gt;Of&lt;/span&gt; T)) _&lt;/pre&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; MethodCallExpression&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="font-size:11pt;background:white;color:black;font-family:consolas;"&gt;&lt;pre style="margin:0px;"&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So where exactly is the problem ?&amp;nbsp; The simple rule is if you want polymorphism (read as “generic variance”) in your code, then you need to expose the types as generic parameters not as concrete types.&lt;/p&gt;
&lt;p&gt;That is, the above is solved by better API design and some simple refactoring.&amp;nbsp; This in fact solves 90% or more of all the cases I have seen.&amp;nbsp; The one place where you can’t do this is when the type is late bound and defined only as Object (more on this in a future post no doubt ;))&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1644183" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Are iterators fundamentally flawed ?</title><link>http://msmvps.com/blogs/bill/archive/2008/08/02/are-iterators-fundamentally-flawed.aspx</link><pubDate>Sat, 02 Aug 2008 02:14:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1643060</guid><dc:creator>bill</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1643060</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/08/02/are-iterators-fundamentally-flawed.aspx#comments</comments><description>&lt;p&gt;It seems apparent that with computers as we currently know them, processors are now set to scale out not up.. that is, clock speeds aren’t rapidly growing, and certainly not doubling every year or two, instead the number of processors on a chip is.&amp;#160; As a case in evidence, 2 or 3 years ago, my PC’s were all single CPU, then a bit over a year ago I bought my new desktop PC and it was a dual core.&amp;#160; And as of a few days ago I swapped that dual core out for a quad core.&amp;#160; For me, the number of cores/CPU’s is clearly doubling every year or two, but clock speed itself isn’t that much faster.&lt;/p&gt;  &lt;p&gt;So what that means for computing is the emphasis is on parallel or concurrent computing. As such, we need to look at the fundamentals and see if they are designed for the task.&amp;#160; Iterators don’t look like they are.&lt;/p&gt;  &lt;p&gt;If you consider an iterator primary task of getting the next element, then look at how it does it, you should observe a major design flaw… the operation is not atomic. An iterator’s implementation is IEnumerator or IEnumerator(Of T), and IEnumerator require you to first call MoveNext then read the Current property.&amp;#160; If you allow multiple threads to use the same IEnumerator, then you could get a call sequence such as MoveNext, MoveNext, Current, Current, which would skip one item and repeat the next one.&amp;#160; So IEnumerator is not well designed for threading.&amp;#160; This is a known design limitation, but rather than address that, languages like C# have implemented their iterators to be a different iterator per thread.&amp;#160; That is they not only recognise the limitation but they also enforce it.&lt;/p&gt;  &lt;p&gt;Going forward, perhaps we need a new IEnumerator class.&amp;#160; In the good bad old days that would be called IEnumerator2(Of T).&amp;#160; IEnumerator2 would make iterating a single method call that would return a Tuple(Of T, Boolean).&amp;#160; It could extend IEnumerator, but it would be difficult to enforce thread safety to the IEnumerator interface. The problem that language like C# would then face is do they risk breaking existing code by returning the same enumerator to different threads ?&amp;#160; Well no they would have to provide an IEnumerable2.GetEnumerator as well, so it would be possible to have the same class used for both single instance per thread and shared class across threads.&amp;#160; As such, then the code that calls the iteration, the For Each loop, would then have to indicate whether it wants to do so using parallel or single threaded.. this would probably surface in the languages such as the For Parallel instruction on a loop.&lt;/p&gt;  &lt;p&gt;So maybe iterators aren’t fundamentally flawed, they just currently have a lot of limitations which can and hopefully will be addressed&amp;#160; as we venture more into the world of multi core :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1643060" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Text preview filters for Vista|Windows 2008</title><link>http://msmvps.com/blogs/bill/archive/2008/07/23/text-preview-filters-for-vista-windows-2008.aspx</link><pubDate>Wed, 23 Jul 2008 05:41:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1641829</guid><dc:creator>bill</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1641829</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2008/07/23/text-preview-filters-for-vista-windows-2008.aspx#comments</comments><description>&lt;p&gt;I really like the preview pane in explorer in Vista, but it doesn’t have previews for a lot of text based files registered.&amp;#160; You can of course write your own or download and install some other preview filters, but personally I find a text preview is all I generally need.&amp;#160; So I re-use the existing Text preview handler and apply it to a range of file types including batch files, .bat, xml, .reg files, .vb and .cs files etc.&amp;#160;&amp;#160; Just copy and run the following .reg file&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Windows Registry Editor Version 5.00 &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.xml\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.reg\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.cmd\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.bat\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.VBS\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.vb\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.vbproj\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.cs\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.csproj\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.sln\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot; &lt;/p&gt;    &lt;p&gt;[HKEY_CLASSES_ROOT\.snippet\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]     &lt;br /&gt;@=&amp;quot;{1531d583-8375-4d3f-b5fb-d23bbd169f22}&amp;quot;&lt;/p&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1641829" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/VB/default.aspx">VB</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Vista/default.aspx">Vista</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://msmvps.com/blogs/bill/archive/tags/CSharp/default.aspx">CSharp</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Windows+Server+2008/default.aspx">Windows Server 2008</category></item></channel></rss>