<?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 : DevCenter</title><link>http://msmvps.com/blogs/bill/archive/tags/DevCenter/default.aspx</link><description>Tags: DevCenter</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>ElementAtOrDefault</title><link>http://msmvps.com/blogs/bill/archive/2009/12/15/elementatordefault.aspx</link><pubDate>Tue, 15 Dec 2009 01:40:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1745625</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=1745625</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/12/15/elementatordefault.aspx#comments</comments><description>&lt;p&gt;VB 9 or later has a particular &lt;em&gt;feature&lt;/em&gt; that can make life easier in some circumstances: the compiler allows you to access indexed items on non indexed enumerables.&amp;#160;&amp;#160; Let’s say you have code such as:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Dim items as IEnumerable(Of String)     &lt;br /&gt;. . . .      &lt;br /&gt;For i = 0 to items.Count - 1      &lt;br /&gt;&amp;#160;&amp;#160; Debug.Print items(i)      &lt;br /&gt;Next&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;VB will compile that for you. The Count is an extension method that loops through the list to determine the count; luckily VB calls that only once. The real killer though is&lt;strong&gt; items(i)&lt;/strong&gt; is actually compiled as &lt;strong&gt;items.ElementAtOrDefault(i). &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;ElementAtOrDefault&lt;/strong&gt; extension tries to cast the IEnumerable(Of T) to an IList(Of T); if the IEnumerable isn’t actually an IList, it loops through the collection, returning at the given index. As you can imagine this would get extremely slow for large lists especially inside a loop.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Good:&lt;/strong&gt;    &lt;br /&gt;&amp;#160;&amp;#160; If your IEnumerable is in fact an IList, such as a List(Of T), then the compiler magically adding this extension call makes life a little easier as you don’t have to cast to IList yourself.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The BAD:     &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160; You have to be really careful when doing any code maintenance, especially if you change an IEnumerable source to a different collection base that doesn’t implement IList(Of T). You can end up writing really bad, slow code really easily.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;I got bitten by the bad, but I caught it immediately as I was curious about the collection base I was using.&amp;#160; In my particular case I had swapped an List(Of T) out with a ConcurrentBag(Of T). ConcurrentBag(Of T) basically uses linked lists where each item is stored as a node. Each node has a previous and next node; the list has a head and a tail. I thought it strange that ConcurrentBag would have an indexer given that would force walking through the nodes. I went to change the items(i) to items.Item(i) and BINGO it wouldn’t compile.&lt;/p&gt;  &lt;p&gt;Possible best practices to avoid being bitten by this:&lt;/p&gt;  &lt;p&gt;(1) Use For Each loops, not indexers. Your code will be far more flexible/manageable&lt;/p&gt;  &lt;p&gt;(2) If you only want the first item, make it explicit by using First or FirstOrDefault extensions.&lt;/p&gt;  &lt;p&gt;(3) Try to do the explicit cast to IList(Of T) yourself and work with an IList(Of T) instead of an IEnumerable(Of T)&lt;/p&gt;  &lt;p&gt;(4) Consider explicitly using the Item property , eg: items.Item(0) instead of items(0)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I’m not really comfortable with having to use the Item property: hopefully practices 1 to 3 will alleviate the need for practice 4.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1745625" 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/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/.NET/default.aspx">.NET</category></item><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>Windows Virtual PC now on MSDN</title><link>http://msmvps.com/blogs/bill/archive/2009/10/08/windows-virtual-pc-now-on-msdn.aspx</link><pubDate>Thu, 08 Oct 2009 04:23:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1730722</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=1730722</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/10/08/windows-virtual-pc-now-on-msdn.aspx#comments</comments><description>&lt;p&gt;If you’ve got Windows 7 installed, the Windows Virtual PC for Windows 7 is now on MSDN subscriber downloads !!!&lt;/p&gt;  &lt;p&gt;I had the Release Candidate (RC) installed, so had to uninstall that first and reboot before installing the RTM release. All worked perfectly, and my VPC’s from the RC also are working fine :)&amp;#160; &lt;/p&gt;  &lt;p&gt;If you need to uninstall the RC you’ll find it listed under the “Programs and Features” window from Control Panel. Click on “View installed updates” top left of window, and you’ll find it listed under “Microsoft Windows”&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1730722" 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/.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/Windows+7/default.aspx">Windows 7</category></item><item><title>Windows crash recovery</title><link>http://msmvps.com/blogs/bill/archive/2009/09/24/windows-crash-recovery.aspx</link><pubDate>Thu, 24 Sep 2009 03:17:31 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1726113</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=1726113</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/09/24/windows-crash-recovery.aspx#comments</comments><description>&lt;p&gt;Last night I accidentally pulled out the wrong power plugs, crashing my computer. For some reason this meant it wouldn’t start properly. I don’t quite get why that would mean it wouldn’t start as the hard disc didn’t fail, but none the less it wouldn’t : the computer would seemingly just hang and the keyboard was no longer responsive and its lights went out.&amp;#160;&amp;#160; The good news is that start-up offered a recovery, and that recovery fixed it and life is good again.&amp;#160; The thing to be aware of though is the recovery boot seemed to be hung for a long long time ; I’m talking like 20 minutes or half an hour.&amp;#160; &lt;/p&gt;  &lt;p&gt;If this happens to you, just be patient: it worked for me :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1726113" 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/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Windows+7/default.aspx">Windows 7</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>Screen-cast recording tools</title><link>http://msmvps.com/blogs/bill/archive/2009/08/17/screen-cast-recording-tools.aspx</link><pubDate>Sun, 16 Aug 2009 13:56:10 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1716165</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=1716165</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/08/17/screen-cast-recording-tools.aspx#comments</comments><description>&lt;p&gt;Recently I got this email from Ted:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&lt;font face="Times New Roman"&gt;Hi Bill!&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;font face="Times New Roman"&gt;Love the snippet tool, it&amp;#39;s great!&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;font face="Times New Roman"&gt;I&amp;#39;m curious, what tool did you use to produce the screencast for the tool? The quality is awesome!&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;font face="Times New Roman"&gt;Thanks a lot!&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;font face="Times New Roman"&gt;Kind regards,&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;&lt;font face="Times New Roman"&gt;Ted&lt;/font&gt;&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The answer to that is I used Camtasia Studio 5. It’s really easy to use and lots of options on output formats. And it will even produce the basic html file for you with the embedded video etc.&lt;/p&gt;  &lt;p&gt;Note: I really like Camtasia. I do also get it for free from the nice folks at &lt;a href="http://www.techsmith.com/" target="_blank"&gt;TechSmith&lt;/a&gt; as they value the contribution MVPs make to the community, and that makes it even easier to like :)&lt;/p&gt;  &lt;p&gt;An alternative worth looking at is Expression Encoder 3 Screen Capture which comes with &lt;a href="http://www.microsoft.com/expression/" target="_blank"&gt;Microsoft Expression&lt;/a&gt; 3. I’ve only given it a quick test drive and it seemed pretty good. Picking formats was a little daunting, but I got it to produce some good quality wmv files that were really good for the bandwidth (small file size). I haven’t driven it enough to find how to produce web files that embed the video; my guess is it would be more silverlight orientated. Still if you have a MSDN subscription that includes expression, it’s definitely worth a look at.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1716165" 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/Snippets/default.aspx">Snippets</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Expression 3 is on MSDN</title><link>http://msmvps.com/blogs/bill/archive/2009/07/27/expression-3-is-on-msdn.aspx</link><pubDate>Mon, 27 Jul 2009 08:01:58 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1710315</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=1710315</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2009/07/27/expression-3-is-on-msdn.aspx#comments</comments><description>&lt;p&gt;With all the focus on Windows 7 RTM announcements, the availability of Expression 3 on the MSDN site last Thursday may have sneaked under folks radars.&amp;#160; &lt;a href="http://msdn.microsoft.com/subscriptions/downloads/default.aspx?PV=62:375:DVD:en:x86" target="_blank"&gt;For MSND subscribers, grab your copy of Expression 3.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1710315" 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/Design/default.aspx">Design</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/Windows+7/default.aspx">Windows 7</category></item><item><title>XML namespace prefix 'xmlns' is not defined</title><link>http://msmvps.com/blogs/bill/archive/2007/11/25/xml-namespace-prefix-xmlns-is-not-defined.aspx</link><pubDate>Sat, 24 Nov 2007 14:58:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1352578</guid><dc:creator>bill</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1352578</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/25/xml-namespace-prefix-xmlns-is-not-defined.aspx#comments</comments><description>&lt;p&gt;When working with VB9 you may get this cryptic error :&lt;br /&gt;&lt;strong&gt;&lt;em&gt;XML namespace prefix &amp;#39;xmlns&amp;#39; is not defined&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;If you are using only default namespaces you can fix this by including a definition for the xmlns as an Import statement or as an xmlns attribute on the XML literal.&amp;nbsp; But if you are using prefixed namespaces imported at file level, then you must add an imports at project level via the project properties reference tab.&lt;/p&gt; &lt;p&gt;You have two choices:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Import System.Xml.Linq for the entire project, or&lt;/li&gt; &lt;li&gt;Import a namespace for the entire project&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you decide to import a namespace it can be any namespace at all.&amp;nbsp; I named one _do_not_use.&amp;nbsp; Problem is it will show up in XML axis properties in intellisense, but with a name like _do_not_use, that isn&amp;#39;t really a big problem. Of course you could add one that you might want to use.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="202" alt="imports" src="http://msmvps.com/blogs/bill/WindowsLiveWriter/XMLnamespaceprefixxmlnsisnotdefined_1BBB/imports_3.png" width="495" border="0" /&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;You may prefer to simply import System.Xml.Linq, but I thought I&amp;#39;d at least throw all the alternatives out there for you to decide what suits you best.&lt;/p&gt; &lt;p&gt;hopefully this is &lt;a href="http://msmvps.com/blogs/bill/archive/tags/Bug/default.aspx" target="_blank"&gt;another&lt;/a&gt; &lt;a href="http://msmvps.com/blogs/bill/archive/tags/Bug/default.aspx" target="_blank"&gt;bug&lt;/a&gt; that will make it into 2008 SP1 ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1352578" 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/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/Bug/default.aspx">Bug</category></item><item><title>Cleaning up your XML literal namespaces</title><link>http://msmvps.com/blogs/bill/archive/2007/11/24/cleaning-up-your-xml-literal-namespaces.aspx</link><pubDate>Sat, 24 Nov 2007 05:16:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1351614</guid><dc:creator>bill</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1351614</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/24/cleaning-up-your-xml-literal-namespaces.aspx#comments</comments><description>&lt;p&gt;If you use XML literals in your code, adding one to another:&lt;/p&gt;
&lt;p&gt;Dim e1 = &amp;lt;a:books&amp;gt;&amp;lt;/a:books&amp;gt;&lt;br /&gt;dim e2 = &amp;lt;a:book&amp;gt;&amp;lt;/a:book&amp;gt;&lt;br /&gt;e1.Add(e2)&lt;br /&gt;&lt;br /&gt;You will have the xmlns declaration repeated in each of the elements, when really it is only needed once per the document or outer element. The problem is caused by VB adding a xmlns declaration as an attribute to the root element. It can get a bit more complex if you have duplicate namespace declarations with different prefixes.&amp;nbsp; So I decided to write a &lt;strong&gt;CleanUpNS&lt;/strong&gt; extension, that keeps the xml written clean by removing un-necessary namespace declarations. To use it, simply add a call to CleanUpNS to the end of your literals, e.g:&lt;br /&gt;&lt;/p&gt;Dim e1 = &amp;lt;a:books&amp;gt;&amp;lt;/a:books&amp;gt;.CleanUpNS&lt;br /&gt;dim e2 = &amp;lt;a:book&amp;gt;&amp;lt;/a:book&amp;gt;.CleanUpNS&lt;br /&gt;e1.Add(e2) 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="FONT-SIZE:11pt;BACKGROUND:#f1f3f2;COLOR:black;FONT-FAMILY:consolas;"&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;Runtime.CompilerServices.Extension()&amp;gt; _&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&lt;span style="COLOR:#3092b1;"&gt;Function&lt;/span&gt; CleanUpNS(&lt;span style="COLOR:#3092b1;"&gt;ByVal&lt;/span&gt; el &lt;span style="COLOR:#3092b1;"&gt;As&lt;/span&gt; XElement) &lt;span style="COLOR:#3092b1;"&gt;As&lt;/span&gt; XElement&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;Dim&lt;/span&gt; current = el.LastAttribute&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;Do&lt;/span&gt; &lt;span style="COLOR:#3092b1;"&gt;While&lt;/span&gt; current &lt;span style="COLOR:#3092b1;"&gt;IsNot&lt;/span&gt; &lt;span style="COLOR:#3092b1;"&gt;Nothing&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;Dim&lt;/span&gt; temp = current.PreviousAttribute&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;If&lt;/span&gt; current.IsNamespaceDeclaration &lt;span style="COLOR:#3092b1;"&gt;AndAlso&lt;/span&gt; el.Name.NamespaceName = current.Value &lt;span style="COLOR:#3092b1;"&gt;Then&lt;/span&gt;&lt;/p&gt;
&lt;p 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; current.Remove()&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="COLOR:#3092b1;"&gt;If&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; current = temp&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;Loop&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;Return&lt;/span&gt; el&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#3092b1;"&gt;End&lt;/span&gt; &lt;span style="COLOR:#3092b1;"&gt;Function&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I go into more details about how this works and how the XML is stored and emitted in my January On VB article in &lt;a href="http://visualstudiomagazine.com/" target="_blank"&gt;Visual Studio Magazine&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1351614" 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/LINQ/default.aspx">LINQ</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/Bug/default.aspx">Bug</category></item><item><title>Snippet paths and duplicates in VS 2008</title><link>http://msmvps.com/blogs/bill/archive/2007/11/21/snippet-paths-and-duplicates-in-vs-2008.aspx</link><pubDate>Wed, 21 Nov 2007 01:07:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1343100</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=1343100</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/21/snippet-paths-and-duplicates-in-vs-2008.aspx#comments</comments><description>&lt;p&gt;If you install VS 2008 on a machine that has VS 2005 on it, you&amp;#39;ll be prompted to let VS 2008 import as many of your settings from 2005 as possible.&amp;nbsp; Generally this is a good thing, but you might run into some issues with code snippets as you might have both the 2005 and 2008 collections loaded in VS 2008.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The problem is Visual Studio stores snippets by default in the %InstallRoot%, which for VS 2005 is Program Files\Microsoft Visual Studio 8 and for VS 2008 it&amp;#39;s Program Files\Microsoft Visual Studio 9.0. But when Visual Studio migrates your settings from 2005 to 2008, it just copies the registry value which include %InstallRoot% in the paths as a replacement variable.&amp;nbsp; So what this means is if you modified the snippets by hand or using some other tool, your new snippets will &lt;strong&gt;NOT&lt;/strong&gt; include the ones you previously modified.&lt;/p&gt; &lt;p&gt;If on the other hand you used the snippet editor in 2005, it saves the paths as the full path, so in VS 2008 you&amp;#39;ll have both the 2005 paths and the 2008 paths.&amp;nbsp; This also is not ideal.&amp;nbsp; You can quickly remove the root folders you don&amp;#39;t want by right clicking on them and selecting remove. (Note: root level folders are the folders stored in the registry and have a blue asterisk on them in the snippet editor)&lt;/p&gt; &lt;p&gt;In either scenario you are still faced with maintaining multiple collections of snippets by default.&amp;nbsp; The best thing you can do is to create a folder in your user do documents folder, and then move sub folders and snippets to that path. This makes it easy to share snippets between versions of Visual Studio.&amp;nbsp; You&amp;#39;ll need to open the collections to remove the paths that are in the %InstallRoot%, but once done you have a centralized common folder tree for your snippets.&lt;/p&gt; &lt;p&gt;In fact, I like the idea of doing that so much, I think I will add a wizard to the Snippet Editor that does this for you.&amp;nbsp; This would also let you have your snippets where you don&amp;#39;t need administer rights to modify them.&lt;/p&gt; &lt;p&gt;There&amp;#39;s also a couple of other minor changes I plan to make later this week, such as surfacing the collection selection onto the folder pane.&lt;/p&gt; &lt;p&gt;Oh, and if you are using the Snippet Editor as is with VS 2008 alongside VS 2005, you might be seeing duplicates for snippets in Visual Studio but not in the Snippet Editor.&amp;nbsp; This is yet another one of the undocumented &amp;quot;quirks&amp;quot; about how Visual Studio deals with snippets. If you look in the languages\CodeExpansions key registry you&amp;#39;ll probably see some values stored under &amp;quot;Basic&amp;quot; and others under &amp;quot;Visual Basic&amp;quot;.&amp;nbsp; This is a &amp;quot;&lt;strong&gt;temporary&lt;/strong&gt;&amp;quot; state.&amp;nbsp; If you run Visual Studio&amp;#39;s Snippet Manager and click on the OK, it will remove the &amp;quot;Basic&amp;quot; key and put all the values under the &amp;quot;Visual Basic&amp;quot; key, at which point the Snippet Editor and VS&amp;#39;s Snippet Manager will all be showing the same collection.&amp;nbsp; When I wrote the Snippet Editor, once the &amp;quot;Visual Basic&amp;quot; key was established in the registry, it meant that the collection was already initialised. If it wasn&amp;#39;t there then I&amp;#39;d initialise it for you. Same kind of thing with &amp;quot;CSharp&amp;quot; and &amp;quot;Visual C#&amp;quot;.&amp;nbsp; But now with 2008 that pattern has changed, as in both keys can be there.&lt;/p&gt; &lt;p&gt;Unfortunately little of this if any is documented, so it means my code has to be reactionary rather than pro-active: That is, I have to fix it when they do things that break it ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1343100" 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/Snippets/default.aspx">Snippets</category></item><item><title>Bug in XML literals around the Imports keywords..</title><link>http://msmvps.com/blogs/bill/archive/2007/11/20/bug-in-xml-literals-around-the-imports-keywords.aspx</link><pubDate>Tue, 20 Nov 2007 08:22:06 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1338789</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=1338789</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/20/bug-in-xml-literals-around-the-imports-keywords.aspx#comments</comments><description>&lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;In VB9, there&amp;#39;s a bug when using XML literals with any type member that is a protected keyword.&amp;nbsp; For example, given the following psuedo types,&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="color:#3092b1;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="color:#3092b1;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;Class&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; Doc&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Property&lt;/span&gt; [Imports]() &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; List(&lt;span style="color:#3092b1;"&gt;Of&lt;/span&gt; DocImports)&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3092b1;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;End&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="color:#3092b1;"&gt;Class&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#3092b1;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;Class&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; DocImports&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:#3092b1;"&gt;Public&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;Property&lt;/span&gt; [Namespace]() &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;String&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:11pt;color:#3092b1;line-height:115%;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;End&lt;/span&gt;&lt;span style="font-size:11pt;line-height:115%;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt; &lt;span style="color:#3092b1;"&gt;Class&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The following code won&amp;#39;t compile:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="color:#3092b1;"&gt;Dim&lt;/span&gt; d &lt;span style="color:#3092b1;"&gt;As&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;New&lt;/span&gt; Doc&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="color:#3092b1;"&gt;Dim&lt;/span&gt; xml = &lt;span style="color:#6464b9;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#844646;"&gt;xml&lt;/span&gt; &lt;span style="color:#b96464;"&gt;version&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;=&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;1.0&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="color:#b96464;"&gt;encoding&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;=&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;utf-8&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#844646;"&gt;Imports&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;From&lt;/span&gt; item &lt;span style="color:#3092b1;"&gt;In&lt;/span&gt; d.Imports&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; _&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="color:#3092b1;"&gt;Select&lt;/span&gt; &lt;span style="color:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#844646;"&gt;Import&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#844646;"&gt;Namespace&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&amp;lt;%=&lt;/span&gt; item.Namespace &lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#844646;"&gt;Namespace&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#844646;"&gt;Import&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:11pt;line-height:115%;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#844646;"&gt;Imports&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;  &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;The trick is to escape the Imports property inside the the XML query:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="color:#3092b1;"&gt;Dim&lt;/span&gt; xml = &lt;span style="color:#6464b9;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#844646;"&gt;xml&lt;/span&gt; &lt;span style="color:#b96464;"&gt;version&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;=&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;1.0&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="color:#b96464;"&gt;encoding&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;=&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;utf-8&lt;/span&gt;&lt;span style="color:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#844646;"&gt;Imports&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="color:#3092b1;"&gt;From&lt;/span&gt; item &lt;span style="color:#3092b1;"&gt;In&lt;/span&gt; d.[Imports]&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; _&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="color:#3092b1;"&gt;Select&lt;/span&gt; &lt;span style="color:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#844646;"&gt;Import&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#844646;"&gt;Namespace&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; item.Namespace &lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#844646;"&gt;Namespace&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#844646;"&gt;Import&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="background:yellow;color:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:11pt;line-height:115%;font-family:consolas;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="mso-spacerun:yes;"&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; &lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#844646;"&gt;Imports&lt;/span&gt;&lt;span style="color:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;This seems to only apply to some keywords, not all. Imports, Sub, Function all cause the problem, yet Class, Private and Namespace don&amp;#39;t.&amp;nbsp; One thing you&amp;#39;ll see is the &amp;lt;%= substitution block won&amp;#39;t get the characteristic highlight colour.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;And another quirk is if the property is called Option, VB will colour that as if it is a keyword even when it is a property such as stock.Option.&amp;nbsp; This one only seems to impact Option, and does not impact the actual compile, only code aesthetics ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1338789" 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/LINQ/default.aspx">LINQ</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/Bug/default.aspx">Bug</category></item><item><title>VS 2008 is LIVE !!!</title><link>http://msmvps.com/blogs/bill/archive/2007/11/19/vs-2008-is-live.aspx</link><pubDate>Mon, 19 Nov 2007 09:25:08 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1334682</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=1334682</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/19/vs-2008-is-live.aspx#comments</comments><description>&lt;p&gt;Just spotted it on MSDN subscriber downloads.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&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=1334682" 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/LINQ/default.aspx">LINQ</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></item><item><title>Update on Snippet Editor</title><link>http://msmvps.com/blogs/bill/archive/2007/11/13/update-on-snippet-editor.aspx</link><pubDate>Tue, 13 Nov 2007 03:45:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1305126</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=1305126</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/13/update-on-snippet-editor.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve finally given the Snippet Editor a major make over including a new look.&amp;nbsp; &lt;/p&gt; &lt;p&gt;To go with this, I&amp;#39;ve given it a new home on my web site:&lt;br /&gt;&lt;a href="http://billmccarthy.com/Projects/Snippet_Editor"&gt;http://billmccarthy.com/Projects/Snippet_Editor&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;And I&amp;#39;ve added a Snippets category to this blog for feedback, info etc.&amp;nbsp; I&amp;#39;ll update the web page with new releases if/when they occur including a change history.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Enjoy&amp;nbsp; :)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;P.S.&amp;nbsp; I&amp;#39;d love to get feedback on the new UI, especially the &amp;quot;About&amp;quot; screen ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1305126" 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/LINQ/default.aspx">LINQ</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Vista/default.aspx">Vista</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/Snippets/default.aspx">Snippets</category></item><item><title>Old error, new look !</title><link>http://msmvps.com/blogs/bill/archive/2007/11/07/old-error-new-look.aspx</link><pubDate>Wed, 07 Nov 2007 02:16:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1285571</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=1285571</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/07/old-error-new-look.aspx#comments</comments><description>&lt;p&gt;In playing with Windows.Forms in VS 2008, I got the same old error I use to get in VS 2005 sometimes:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;Type must be a type provided by the runtime. Parameter name: type&lt;/em&gt;&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;p&gt;The good news is it looks so much prettier in VS 2008.&amp;nbsp; It&amp;#39;s not fixed, but look, isn&amp;#39;t it pretty ? &lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="515" alt="error" src="http://msmvps.com/blogs/bill/WindowsLiveWriter/Olderrornewlook_BA8B/error_3.png" width="700" border="0" /&gt;&lt;/em&gt;&lt;/strong&gt; &lt;p&gt;&amp;nbsp; &lt;p&gt;&amp;nbsp; &lt;p&gt;So why is it that the phrase &amp;quot;&lt;strong&gt;&lt;em&gt;lipstick on a pig&lt;/em&gt;&lt;/strong&gt;&amp;quot; come flooding into my mind ??? &lt;p&gt;&amp;nbsp; &lt;p&gt;BTW: The fix is to show the DataSources window before trying to open the form designer &lt;p&gt;&amp;nbsp; &lt;p&gt;. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1285571" 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/DevCenter/default.aspx">DevCenter</category></item><item><title>Snippet Editor 2008 release</title><link>http://msmvps.com/blogs/bill/archive/2007/11/06/snippet-editor-2008-release.aspx</link><pubDate>Tue, 06 Nov 2007 11:49:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1284756</guid><dc:creator>bill</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1284756</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/06/snippet-editor-2008-release.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve updated the Snippet editor to work with Visual Studio 2008 and 2005 releases.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;Note this release requires .NET 3.5.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Changes/fixes:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added 2008 product range to the list of products&lt;/li&gt;
&lt;li&gt;Fixed replacement of the install root variable for Visual Studio that was resulting in a double \ midway of file paths&lt;/li&gt;
&lt;li&gt;Removed VB&amp;#39;s single instancing and replaced it with named pipes messaging. This fixes various issues to do with firewalls, and the remoting VB tries to do. See Visual Studio Magazine November for details on the NamedPipes usage.&lt;/li&gt;
&lt;li&gt;Set the required permissions to run the application as Administrator for Vista.&amp;nbsp; Without this, the app would run, but snippets would be saved in the VirtualStore where Visual Studio wouldn&amp;#39;t see them properly.&amp;nbsp; The problem revolves around Visual Studio having the snippet stores in the Program Files tree.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strike&gt;The download includes the source and the release build. (in the bin\release path)&lt;/strike&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE: The files are now available from &lt;/strong&gt;&lt;a class="" href="http://billmccarthy.com/Projects/Snippet_Editor"&gt;&lt;strong&gt;my web site&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; (&lt;/strong&gt;&lt;a href="http://billmccarthy.com/Projects/Snippet_Editor"&gt;&lt;strong&gt;http://billmccarthy.com/Projects/Snippet_Editor&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;)&lt;/strong&gt;&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=1284756" 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/Vista/default.aspx">Vista</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/VB10/default.aspx">VB10</category></item><item><title>Oh so you want polymorphism ???</title><link>http://msmvps.com/blogs/bill/archive/2007/11/05/oh-so-you-want-polymorphism.aspx</link><pubDate>Mon, 05 Nov 2007 05:47:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1283368</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=1283368</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/05/oh-so-you-want-polymorphism.aspx#comments</comments><description>&lt;p&gt;I recall almost four years ago to this day, I was at the 2003 PDC in LA. On the last day of the conference, the head architects of different .NET languages got together and talked about language directions, generics and some of the &amp;quot;VS 2005&amp;quot; stream of things.&amp;nbsp; There was a Q&amp;amp;A session at the end, and I stood in line to ask a question about generics. They were about to cut off all questions, but I managed to ask the final question for the day.&amp;nbsp; I asked about generics and &amp;quot;polymorphism&amp;quot;. Anders didn&amp;#39;t seem to quite get what I meant at first, then when I gave the example of being able to treat IList(of Apple) as IList(Of Fruit), he said &amp;quot;&lt;em&gt;oh you mean generic covariance and contravariance&lt;/em&gt;&amp;quot; or words to that effect. The reply was no, saying the cost would be too high although he did suggest one of the other less common languages on .NET (no not VB &amp;lt;g&amp;gt;)&lt;/p&gt;
&lt;p&gt;Fast forward four years, and &lt;a href="http://blogs.msdn.com/ericlippert/archive/2007/10/16/covariance-and-contravariance-in-c-part-one.aspx" target="_blank"&gt;now the C# team are finally talking about this&lt;/a&gt; ! At first I thought cool, Eric and the C# team are onto this. Then around his seventh or eight post on the topic he started to loose me as it seems they&amp;#39;ve shifted the focus on to a new syntax for defining the interfaces, which isn&amp;#39;t really going to address the issue IMO. And I question just how that will surface in the IDE, and whether T is + or - really even makes sense at the interface level as it really needs depends on whether T is a return value or a parameter. Potentially I could see some advantage there, probably to do with that functional programming cloud, but it seems to have drifted away from the real need.&lt;/p&gt;
&lt;p&gt;The most common need I see is when you have things such as a List(Of Customer) and you want to work with it as a List(Of BusinessBase). It&amp;#39;s also especially difficult when you are passed the list as an Object, such as from a DataSource and you want to check to see if it is a IList(of BusinessBase).&amp;nbsp; Really what we need is a view of the object.&lt;/p&gt;
&lt;p&gt;Some views are safe, such as treating an IEnumerable(Of Customer) as IEnumerable(Of BusinessBase), but others are not, such as IList(Of Customer) to an IList(Of BusinessBase), but for the most part when we want those views we are interested in only the safe part.&amp;nbsp; It&amp;#39;s not like we can retrospectively change IList, or that at present we could have one Interface definition for the Item Get, and another for the Item Set. What would be nice is being able to use a view, and the compiler/IDE warn if you use any of the unsafe part, like Item Set, or if you pass the view to a method etc, yet allow you safely to do things such as access Count, get the Items and do operations on them as if they were business object base classes.&amp;nbsp; These things are safe, yet today generics does not allow for that (note if you have generic parameters cascading throughout this issue does not arise, but that doesn&amp;#39;t work with Object parameters, or current event design etc)&lt;/p&gt;
&lt;p&gt;So some psuedo verbose code to explain what I would like:&lt;br /&gt;&lt;br /&gt;&lt;font color="#008000"&gt;&amp;#39; assume datasource is As Object, but is a IList(Of Customer)&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;If datasource IsViewable As IList(Of BusinessBase) Then&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim view As ViewOf IList(Of BusinessBase) = ViewOf( datasource, IList(Of BusinessBase))&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; For i As Int32 = 0 to view.Count - 1&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; view(i).Validate&amp;nbsp; &lt;font color="#008000"&gt;&amp;#39; legal as Validate is defined on BusinessBase&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim temp as BusinessBase = view(i)&amp;nbsp; &lt;font color="#008000"&gt;&amp;#39; legal&lt;br /&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; view(i) = temp&amp;nbsp; &lt;font color="#008000"&gt;&amp;#39; compiler warning of potential runtime error&lt;br /&gt;&lt;/font&gt;Next&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Likewise you could create a ViewOf IList(Of Customer) from an IList(Of Person), but here the inverse would apply in code, meaning you could add a customer to the datasource, but you&amp;#39;d get a warning treating a person as a customer as that might not be the case. &lt;/p&gt;
&lt;p&gt;If the datasource is as object though, the compiler can&amp;#39;t know if the datasource is contra or co variant to the view. By default a &amp;quot;View&amp;quot; should be treated as a widening, that is a ViewOf IList(of BusinessBase), would mean the datasource is assumed to be a ViewOf IList(Of DerivedFromBusinessBase). The same rules for variance as we see today with delegate variance would apply. If the view wanted was one that is potentially unsafe, such as IList(Of Customer) from an IList(Of Person) then the view should be specified as a NarrowingView.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want to redefine IList, or have to mess with defining which generic parameters are covariant and contravariant and where. What I want is to be able to deal with generic types with variance and create views such as the compiler tells me what is and isn&amp;#39;t legal with that view, what&amp;#39;s safe and what isn&amp;#39;t. And most importantly it has to work with existing generic types and interfaces out there today.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So perhaps my response is four years late, but no I don&amp;#39;t mean contravariance and covariance, I mean polymorphism :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1283368" 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/Orcas/default.aspx">Orcas</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></item><item><title>Counting deck chairs on the titanic</title><link>http://msmvps.com/blogs/bill/archive/2007/11/02/counting-deck-chairs-on-the-titanic.aspx</link><pubDate>Fri, 02 Nov 2007 05:57:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1277773</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=1277773</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/02/counting-deck-chairs-on-the-titanic.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.panopticoncentral.net/archive/2007/11/01/22453.aspx" target="_blank"&gt;Paul Vick released some statistics in relation to VB&lt;/a&gt;, which for discussion sake I&amp;#39;ll repeat here :&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Visual Basic is the #1 .NET language (as reported by Forrester Research)  &lt;li&gt;Visual Basic is the #1 downloaded and #1 registered Express Edition (topping the #2 position by 20%)  &lt;li&gt;Visual Basic is the #1 MSDN language dev center and blog in terms of traffic  &lt;li&gt;The Visual Basic Team blog is in the top 1% in readership of all MS bloggers (I don&amp;#39;t know where I fall in that since I host independently.)&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;I think you&amp;#39;d have to be taking the happy pills to see anything great in those stats, after all they avoid real numbers and they don&amp;#39;t tell the underlying trend or growth.&lt;/p&gt; &lt;p&gt;Five or so years ago, before .NET formally launched, Microsoft reported VB as being the *MOST* popular language of *ALL* programming languages. Reports from Forrester backs this up, and this graph from O&amp;#39;Reilly books shows that VB was the most popular titles.&lt;/p&gt; &lt;p&gt;&lt;a href="http://msmvps.com/blogs/bill/WindowsLiveWriter/Countingdeckchairsonthetitanic_E6A5/Oreilly_2.png" target="_blank"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="310" alt="Oreilly" src="http://msmvps.com/blogs/bill/WindowsLiveWriter/Countingdeckchairsonthetitanic_E6A5/Oreilly_thumb.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Note in the above graph that VB was as popular as Java at the start of 2003 but has been on a steady decline. C# on the other hand was showing a slow but steady increase.&lt;/p&gt; &lt;p&gt;Forrester also in &lt;a href="http://www.forrester.com/Research/Document/Excerpt/0,7211,37356,00.html" target="_blank"&gt;mid 2005 released these figures&lt;/a&gt;:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Java&amp;#39;s 66% penetration is the highest among strategic programming languages for enterprise applications.&lt;/li&gt; &lt;li&gt; Visual Basic 6 (VB6) and C/C++ have nearly as much penetration as Java,&lt;/li&gt; &lt;li&gt;Visual Basic .NET (VB.NET) had 34% penetration&lt;/li&gt; &lt;li&gt;C# had 15% penetration&lt;/li&gt; &lt;li&gt; If all VB6 users converted to VB.NET, its share would increase to 70%. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The last statistic is an interesting one, what it tells us is that VB was the most popular language, and by mid 2005 VB.NET had managed to attract less than half of those VB had prior to the move to .NET.&lt;/p&gt; &lt;p&gt;More recent statistics are harder to come by. Anecdotal reports are that book sales of C# related topics are out selling VB at the ratio of 2:1.&amp;nbsp; If books aren&amp;#39;t a great indicator of growth trends perhaps jobs are.&amp;nbsp; Searches at seek.com.au show C# jobs running at 7 jobs per every 3 that specify VB. There&amp;#39;s some overlap but that&amp;#39;s still a greater than 2:1 ratio.&amp;nbsp; Likewise jobs at monster.com tally up similarly. Interestingly both also show J2EE about on par with C# and Java slightly higher. If you combine VB and C# there&amp;#39;s not much in it compared to Java overall in the job market.&lt;/p&gt; &lt;p&gt;So what of stats from Microsoft ?&amp;nbsp; Surely Microsoft would have figures and be touting it&amp;#39;s success ??&amp;nbsp; Well no, not really. These cryptic figures Paul released are all I can find except for anecdotal quotes such &lt;a href="http://blogs.msdn.com/joestagner/archive/2007/10/17/why-are-the-how-do-i-videos-in-visual-basic.aspx" target="_blank"&gt;as the quote from Joe Stagner&lt;/a&gt; that there are more VBers than &amp;quot;C# folk but the gap is narrowing&amp;quot;.&amp;nbsp; So what is it Paul actually is telling us ?&lt;/p&gt; &lt;p&gt;&lt;br /&gt;1&lt;em&gt;. Visual Basic is the #1 .NET language (as reported by Forrester Research) &lt;/em&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp; Okay so VB has gone from being the most popular language, to being just the most popular on .NET, a relative decline in market share. And the titanic was still the biggest floating ship right up till the moment it sunk, even when it was taking on water.&amp;nbsp; To take a language from the most popular of ALL languages, to one of just a subset of languages is a negative trend :(&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;2. &lt;em&gt;Visual Basic is the #1 downloaded and #1 registered Express Edition (topping the #2 position by 20%) &lt;/em&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp; That figure alone is to be expected given VB6 was the most popular. You&amp;#39;d expect those people to at least try out VB Express unless marketing really screwed up. Again it tells us nothing about forward trends, just an indication of the past penetration that was there&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;3.&lt;em&gt; Visual Basic is the #1 MSDN language dev center and blog in terms of traffic &lt;/em&gt;&lt;/p&gt; &lt;p&gt; Again that related heavily to the previous versions of VB.&amp;nbsp; If you visit the VB MSDN site, that&amp;#39;s where you also find info on previous versions. Look at the downloads for VB, and &lt;a href="http://www.microsoft.com/downloads/browse.aspx?displaylang=en&amp;amp;productid=1652d9a4-f0b3-4630-acd5-56982ea750ab" target="_blank"&gt;even today the most popular download&lt;/a&gt; is Visual Basic 6. &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;em&gt;4. The Visual Basic Team blog is in the top 1% in readership of all MS bloggers &lt;/em&gt;&lt;/p&gt; &lt;p&gt;There are about 4500 blogs on MSDN, so 1% is the top 45 blogs.&amp;nbsp; What that is telling us is that the team blog for VB only rates in the top 45 of blogs for Microsoft&amp;#39;s Developer Network blogs. What are the other 44 ?&amp;nbsp; And what does that tells us ? That we should all be programming in Scobble ?&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I think the sad truth is that VB continues to decline due to market place perception.&amp;nbsp; VB is in fact a very capable language. In fact in many ways it is better than C#. Form a pure technical perspective VB is the best language of the two for working with COM legacy applications. In 2008, VB is also the best of the two for working with XML. C#&amp;#39;s only technical feature that gives it a real edge is unsafe code. &lt;/p&gt; &lt;p&gt;So why is VB declining while C# is on the rise ?&amp;nbsp; Microsoft is heavily to blame here. Although they say you are free to choose what ever language you like, they don&amp;#39;t do that, they continue to choose C# over VB and the market place knows that.&amp;nbsp; Given it&amp;#39;s their platform we are actually coding on, it&amp;#39;s understandable that we view their developers as leaders.&amp;nbsp; And they lead towards C#.&lt;/p&gt; &lt;p&gt;Cost and time also figure into it heavily. Microsoft has sent out a clear message that if you want to work with Windows Live Id, Windows Search, Health Vault, .NET Micro Framework, XNA, then they don&amp;#39;t view VB as important enough for them to vest any time on, so why should/would you ?&amp;nbsp; They&amp;#39;ve made it clear they are going to pigeon hole VB.&lt;/p&gt; &lt;p&gt;Let me give you an example. Let&amp;#39;s say today you wanted to incorporate the latest from the Patterns and Practices team.&amp;nbsp; If you go over to CodePlex, you&amp;#39;ll find the latest code in C#.&amp;nbsp; If you want to build your app, but still have the flexibility to make changes, you&amp;#39;ll need to go with C#.&amp;nbsp; In fact if you look over at CodePlex, you&amp;#39;ll find that C# projects outweigh VB at the ratio of about 7 : 1.&amp;nbsp;&amp;nbsp; And many of those projects are lead by Microsoft employees as part of their day job.&lt;/p&gt; &lt;p&gt;This leading of community projects, the work being done internally around C# all lead to C# developing greater market share as well as improving C# itself as the language gets &amp;quot;dog-fooded&amp;quot; more by Microsoft, thus gaining input from some of the world&amp;#39;s best developers from practical usage of it.&amp;nbsp; It&amp;#39;s self feeding.&lt;/p&gt; &lt;p&gt;For Microsoft as a whole, they look at .NET penetration. The increase in C# at the expense of VB doesn&amp;#39;t really matter, it&amp;#39;s overall market share that does.&amp;nbsp; Except perhaps for one really telling statistic.&amp;nbsp; As Forrester said, if all the VB community switched to VB.NET back in 2005, VB would have had 70% market penetration.&amp;nbsp; Given such a huge potential, it has to be negligent to let that slip away, and instead favor a new language because internally more people at Microsoft used C++.&amp;nbsp; Really, the question should have been was there ever any need for C# given VB&amp;#39;s huge market share ?&amp;nbsp; Now the question is&amp;nbsp; beginning to be the opposite.&lt;/p&gt; &lt;p&gt;And so it goes, we should be happy when they tell us how many deck chairs on the titanic, that the ship is unsinkable, yet we see the water line drawing nearer and nearer.......&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1277773" 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/Life/default.aspx">Life</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Rant/default.aspx">Rant</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://msmvps.com/blogs/bill/archive/tags/LINQ/default.aspx">LINQ</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></item><item><title>OK is not OK, but Close is ?</title><link>http://msmvps.com/blogs/bill/archive/2007/11/01/ok-is-not-ok-but-close-is.aspx</link><pubDate>Thu, 01 Nov 2007 02:22:58 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1276274</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=1276274</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/11/01/ok-is-not-ok-but-close-is.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve been rummaging through the Windows Vista User &lt;strike&gt;&lt;font color="#800000"&gt;Interface &lt;/font&gt;&lt;/strike&gt;&lt;font color="#0000ff"&gt;Experience&lt;/font&gt; Guidelines draft, &lt;a href="http://www.microsoft.com/downloads/info.aspx?na=22&amp;amp;p=12&amp;amp;SrcDisplayLang=en&amp;amp;SrcCategoryId=10&amp;amp;SrcFamilyId=&amp;amp;u=%2fdownloads%2fdetails.aspx%3fFamilyID%3de49820cb-954d-45ae-9cb3-1b9e8ea7fe8c%26DisplayLang%3den" target="_blank"&gt;a 33 MB pdf file&lt;/a&gt;, and it poses some interesting questions around warning and exception dialog messages.&amp;nbsp; Now apparently it is not OK to present the user with an exception message and an OK button.&amp;nbsp; Instead the guidelines recommend the button caption should be &amp;quot;&lt;strong&gt;Close&lt;/strong&gt;&amp;quot;.&amp;nbsp; Is that close as in &amp;quot;so close but yet so far&amp;quot; ?&amp;nbsp; Or close as in we&amp;#39;re about to shut down your application and windows and you&amp;#39;ll loose all unsaved work ?&amp;nbsp; (that one always gets people when you use a modal dialog &amp;lt;g&amp;gt;)&amp;nbsp; . &lt;/p&gt; &lt;p&gt;Close seems incredibly wrong to me. In fact I&amp;#39;m sure when I&amp;#39;ve assisted folks over the phone and some other application or windows has presented them with only the option of &amp;quot;close&amp;quot; it has caused much angst. I raised this with Nick Randolph and he suggested that perhaps a better caption would be &amp;quot;Continue&amp;quot; . I think that&amp;#39;s a good option in some cases. In others where you can&amp;#39;t continue as such, instead you &amp;quot;Resume&amp;quot; and in others you might go back to the screen/page from where you launched the original request, hence &amp;quot;Back&amp;quot;.&lt;/p&gt; &lt;p&gt;Continue, Resume, Back, and dare I even suggest Retry or Ignore, but not Close.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1276274" 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/DevCenter/default.aspx">DevCenter</category></item><item><title>Schemas in the scheme of things...</title><link>http://msmvps.com/blogs/bill/archive/2007/10/29/schemas-in-the-scheme-of-things.aspx</link><pubDate>Sun, 28 Oct 2007 13:17:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1270752</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=1270752</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2007/10/29/schemas-in-the-scheme-of-things.aspx#comments</comments><description>&lt;p&gt;I got an interesting email today, which, to paraphrase, said:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;I would like a syntax where I can say “an XElement that follows this XSD&amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This question actually digs deep into the issue of strong typing versus dynamic typing and what it really is we want from a type system. &lt;/p&gt; &lt;p&gt;A lot of people think of strong typing as a forced constraint that ensures that types used are are of a particular type and that this constraint can then be used to facilitate design time checking and the intellisense experience. Although this is true, people often forget that the strong typing doesn&amp;#39;t eliminate type errors, it just limits them. For example, whenever you do a narrowing cast you risk a runtime error not a design time one.&amp;nbsp; In .NET the need for narrowing is pretty common: one only needs to think of the standard event signatures where sender is always As Object. So what strong typing does is &amp;quot;shift&amp;quot; some of the errors.&amp;nbsp; When it comes to XML the concept of shifting the validation of the object becomes even more important&lt;/p&gt; &lt;p&gt;To address the problem of strong typing with an XElement, you could use inheritance but this raises a lot of issues. Factory methods such as Load return an XElement, so you&amp;#39;d have to provide your own Load methods. In the end it&amp;#39;d probably be easier to have your object model not inherit from XElement, rather just use XElement as the internal container.&amp;nbsp; This would give you the ability to write POCO (plain old CLR Objects) classes for your data, but in doings so you face a couple of serious design issues.&amp;nbsp; If you choose to validate the data at load time, that can cause excessive delays in loading the XML especially if parts of it are not used. If you don&amp;#39;t validate at load, your object model can actually have an invalid state and do unpredictable things such as throw exceptions when a property is accessed.&amp;nbsp; And there&amp;#39;s also the issue that XML can contain more data than the schema dictates. Do you loose that data or preserve it ? If you preserve it, then how do you provide access to it while also preserving the other data integrity ?&lt;/p&gt; &lt;p&gt;As you can probably see, there&amp;#39;s a mismatch here between POCO and XML&lt;/p&gt; &lt;p&gt;If the goal is to validate the XML, you can do that with XDocument by providing a XMLReader with the XMLReaderSettings set to validate against a schema. Alternatively you can let the exceptions occur when a member is accessed. So XElement provides a flexible way of validating either when loaded or when accessed. But what&amp;#39;s missing still is the design time experience......&amp;nbsp; &lt;/p&gt; &lt;p&gt;So how can we get a great design time experience with an XElement akin to strong typing but without all the drawbacks strong typing and POCO present ?&amp;nbsp; I think the answer is in dynamic interfaces that are XElements, not POCO.&amp;nbsp; For example let&amp;#39;s say I could write a:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Public XInterface IPerson&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Name&amp;gt; As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Age&amp;gt; As Int32&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @ID As GUID&lt;br /&gt;End XInterface&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;You could then define an XElement parameter or variable as IPerson, and get a great design time experience.&amp;nbsp; You&amp;#39;d still have to decide if you wanted to validate your XML when you load it, or just wait and see, but really that&amp;#39;s a great performance flexibility :)&lt;/p&gt; &lt;p&gt;The XInterface above is a simple model where you define the values in term of CLR types, so when accessed the appropriate conversions will be done from you from XML to that type. For more complex models it&amp;#39;s be nice if you could also define a XInterface from a schema, and the compiler would infer the appropriate CLR types from the XML types. In this case you&amp;#39;d have to provide the schema to define the interface.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Imports XElement IPerson = &amp;quot;myPersonSchema.xsd&amp;quot;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Where &amp;quot;mypersonSchema.xsd&amp;quot; would be the name of a file in the project or a file path or URL/URI.&lt;/p&gt; &lt;p&gt;With dynamic interfaces that are based around XElement, you could provide a really great rich design time experience for XML.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1270752" 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/DevCenter/default.aspx">DevCenter</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB10/default.aspx">VB10</category></item></channel></rss>