<?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</title><link>http://msmvps.com/blogs/bill/default.aspx</link><description>&lt;br /&gt; Bill&amp;#39;s random thoughts...</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Visual Studio toolbar</title><link>http://msmvps.com/blogs/bill/archive/2012/03/07/visual-studio-toolbar.aspx</link><pubDate>Wed, 07 Mar 2012 06:46:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1807064</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=1807064</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2012/03/07/visual-studio-toolbar.aspx#comments</comments><description>&lt;p&gt;The beta of Visual Studio 11 is causing a lot of feedback around the grey shade icons.&amp;#160; The use of colour or not has also brought to the forefront the UI for colour-blind people.&amp;#160; So I thought I’d post a picture of my toolbar, along with some links to see the page as seen by those with colour-blindness...&lt;/p&gt;  &lt;p&gt;My toolbar:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/1033.image_5F00_7AB68892.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/3554.image_5F00_thumb_5F00_5F31868F.png" width="1230" height="71" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Colour-blind filter web site: &lt;a title="http://colorfilter.wickline.org/" href="http://colorfilter.wickline.org/"&gt;http://colorfilter.wickline.org/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This post on the above site:    &lt;br /&gt;&lt;a title="http://colorfilter.wickline.org/?a=1;r=;l=0;j=1;u=msmvps.com/blogs/bill/archive/2012/03/07/visual-studio-toolbar.aspx;t=p" href="http://colorfilter.wickline.org/?a=1;r=;l=0;j=1;u=msmvps.com/blogs/bill/archive/2012/03/07/visual-studio-toolbar.aspx;t=p"&gt;http://colorfilter.wickline.org/?a=1;r=;l=0;j=1;u=msmvps.com/blogs/bill/archive/2012/03/07/visual-studio-toolbar.aspx;t=p&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1807064" 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/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/Design/default.aspx">Design</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VS+10/default.aspx">VS 10</category></item><item><title>windows 8 likes and dislikes</title><link>http://msmvps.com/blogs/bill/archive/2012/03/03/windows-8-likes-and-dislikes.aspx</link><pubDate>Sat, 03 Mar 2012 02:40:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1806833</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=1806833</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2012/03/03/windows-8-likes-and-dislikes.aspx#comments</comments><description>&lt;p&gt;There’s a lot to like in windows 8 preview: it’s easy to see how windows 8 will be a hit on tablet devices; there’s massive synergy with windows phone; the built in windows live experience combined with your settings in the cloud, make it smooth to go from one device to another. But there’s other bits I’m not so fond of ...&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Start Menu&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Obviously the biggest change people first see is the start menu is now a start page. I like the concept but dislike the fine details on how it is implemented. At present to get to the start menu you have to move your cursor to the lower left of the screen; to see “running” apps you have to move it to the upper left then swipe down; to see all applications you need to right click to see the “toolbar” along the bottom of the screen and select all apps. It’s those details I don’t like. They aren’t intuitive, they aren’t obvious. People have to go through an initial period of disorientation: that’s a negative first taste for existing customers. What I’d much prefer to see is :&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Put the windows start button back: not the start menu, just the button. Call it branding if you like, but having the windows button visible always would make the experience a lot more intuitive     &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Make the start screen a start portal, not just a start menu replacement. That is, get rid of the silly running application list on the left and instead have the start screen have three or four title style buttons along the top (similar to windows pivot app style) that would give you the choice of Favourites, Running and All. Perhaps even a Most Recent as well. The running app list at the side just doesn’t work well for me. They look too much alike, there’s no captions, and the space is limited. It’d make a lot more sense to use the whole screen for running apps, just like it makes sense to use the entire screen for the start “menu”. Currently there is a disconnect of design.     &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;When in desktop mode the start button would be there (see 1 above). Clicking on it would show you the start screen BUT not in full screen mode. Instead have the start screen appear floating: eg a 20 pixel margin all around and a drop shadow. It would make the experience feel more connected rather than the current disconnect.     &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Allow metro apps to run in “windows”. That is you should be able to preference any metro app to run inside a window on the desktop. This should be a right click preference from the start screen, and likewise from the running app screen to move apps to and from the desktop windows experience. I think this is important for a lot of existing customers who will find themselves still on the desktop and currently experience a disconnect from the metro start screen.     &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Better panel docking. It seems a step backwards when you can only dock as a thin pane to the side without being able to resize. This totally failed for me when I tried to have my mail on the left pane and my calendar as the main screen (try it: I couldn’t actually read the email). Panels should be able to be sized, apps need to be able to respond to that better than what’s in the preview, and most importantly you should be able to work with desktop applications (4, above would help solve this for metro and desktop apps working side by side)&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Overall I kind of like windows 8: I’d like to like it a lot more but it just doesn&amp;#39;t feel as if it is there yet. I think the above list of changes would go a long way to bring in the new experience in a much less discordant way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1806833" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/Windows+8/default.aspx">Windows 8</category></item><item><title>VB Quark #7 : Optional Parameters and Dates</title><link>http://msmvps.com/blogs/bill/archive/2011/11/09/vb-quark-7-optional-parameters-and-dates.aspx</link><pubDate>Wed, 09 Nov 2011 04:14:54 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1802239</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=1802239</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/11/09/vb-quark-7-optional-parameters-and-dates.aspx#comments</comments><description>&lt;p&gt;Hopefully you already know VB has full support for Optional parameters, both declaring them and calling them, but did you know you can use Dates as Optional parameters ?&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Sub&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; AddNewCustomer(customer &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;,&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;&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;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Optional&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; dateAdded &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Date&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Nothing&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;)         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; dateAdded = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Nothing&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Then&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; dateAdded = Now&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt; VB has had this support for Optional parameters in place for the last decade or so in .NET and for years before that back in the COM versions of VB. &lt;/p&gt;  &lt;p&gt;In the last release of .NET (VS 2010), C# finally got support for Optional parameters, so the above in C# would look like:&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;void&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; AddNewCustomer(&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; customer,&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;&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; &lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; dateAdded = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;default&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;))         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;if&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; (dateAdded == &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;default&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;)) dateAdded = &lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;.Now;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;    &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The Nothing in the VB declaration is the same as default(DateTime) in C#, which equates to the theoretical Gregorian date of 1/1/0001.&lt;/p&gt;  &lt;p&gt;But what if you want to specify a default date ? Well because VB supports date literals, in VB you can, but in C# you can’t.&amp;#160; In VB you can write any date literal for the optional parameter value. For example, you might have some legacy database support, and when the date is unknown you want to use the equivalent of an OLE Date’s zero value:&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Sub&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; AddNewCustomer(customer &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;,         &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;&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;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Optional&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; dateAdded &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Date&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; = #12/30/1899#)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When the VB compiler compiles this, it adds a System.Runtime.CompilerServices.DateTimeConstantAttribute to the parameter information with the default value stored as an Int64 (the number of ticks). C# actually sees the optional value in the above example and will use it. That is both VB and C# can call the code taking advantage of the optional value for the date parameter, but only VB let’s you define that value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1802239" 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><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>Displaying Dates in VS 2010</title><link>http://msmvps.com/blogs/bill/archive/2011/11/08/displaying-dates-in-vs-2010.aspx</link><pubDate>Tue, 08 Nov 2011 05:30:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1802185</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=1802185</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/11/08/displaying-dates-in-vs-2010.aspx#comments</comments><description>&lt;p&gt;From time to time there&amp;rsquo;s discussion about the way dates are displayed in the Visual Studio IDE for Visual Basic. Typically dates are shown using VB&amp;rsquo;s date literal syntax of #MM/dd/yyyy# which is the standard US format.&amp;nbsp; For people outside of the USA this can be confusing or ambiguous at times.&amp;nbsp; The good news is Visual Studio allows you to easily add your own display formatter.&lt;/p&gt;
&lt;p&gt;Simply create a new class library project, add the following attribute to your AssemblyInfo file:&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:Consolas;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-size:10pt;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;Assembly&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;: &lt;/span&gt;&lt;span&gt;&lt;span style="color:#000088;"&gt;DebuggerDisplay&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;span style="background-color:#fefff0;color:#a31515;"&gt;&amp;quot;Date: {ToString(&amp;quot;&amp;quot;s&amp;quot;&amp;quot;)}&amp;nbsp;&amp;nbsp; kind={Kind}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, Target:=&lt;/span&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;GetType&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000088;"&gt;DateTime&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;))&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And then just copy the assembly to your Visualizers directory, eg: &lt;br /&gt;&amp;nbsp; My Documents\Visual Studio 2010\Visualizers&lt;/p&gt;
&lt;p&gt;I added the Kind property to the display so as you can easily see if the Date is a local date, UTC or unspecified.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve attached a sample project.&amp;nbsp; Enjoy &lt;img src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/3000.wlEmoticon_2D00_smile_5F00_4E15BC0E.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1802185" width="1" height="1"&gt;</description><enclosure url="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.01.80.21.85/ISODateDisplay.zip" length="5892" type="application/x-zip-compressed" /><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/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/.NET+4.0/default.aspx">.NET 4.0</category></item><item><title>VB Quark #6: Date operators</title><link>http://msmvps.com/blogs/bill/archive/2011/10/26/vb-quark-6-date-operators.aspx</link><pubDate>Wed, 26 Oct 2011 06:28:19 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1801661</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=1801661</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/10/26/vb-quark-6-date-operators.aspx#comments</comments><description>&lt;p&gt;The DateTime structure in .NET includes custom operators for Date comparisons such as less than, greater than, equal and not equal; but did you know it also includes addition and subtraction operators ?&amp;#160; There’s two subtraction operators and one addition operator defined inside DateTime:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;date = date – timespan&lt;/li&gt;    &lt;li&gt;timespan = date – date&lt;/li&gt;    &lt;li&gt;date = date + timespan&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Those three cases should all seem relatively obvious, such as adding or subtracting an hour from a date, or calculating how many minutes between two dates etc...&lt;/p&gt;  &lt;p&gt;BUT, did you know VB also defines another case where you can add two dates, eg:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Dim result = Date1 + Date2&lt;/p&gt;  &lt;p&gt;Now if you guessed that the type of result is String, then congratulations !! Note: this operator resolution is only valid with Option Strict Off&lt;/p&gt;  &lt;p&gt;Obviously adding two dates can’t give a valid date or timespan, so the only real options are to return a string concatenation of the date or throw an error. There are a couple of fringe cases where, depending on your system locale, the resultant string can indeed be parsed back into a date, eg:&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Dim&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; dt1 = #1:00:00 PM#         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Dim&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt; dt2 = Now.Date         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Dim&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; dtResult &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Date&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; = dt1 + dt2&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;    &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;But that really is a fringe case, and would depend on the system locale formatting. &lt;/p&gt;  &lt;p&gt;I think it’s probably fair to say this case is a quirk of a quark, probably introduced as partial legacy. I honestly can’t see any usefulness of the addition operator between two dates that returns a string. If the intent was some legacy support, it might have made sense to return a date if one of the dates was date zero with time information, but the concatenation of the date strings doesn’t seem to reliably serve any purpose.&lt;/p&gt;  &lt;p&gt;The good news is you can only do the string = date + date operation with Option Strict Off. Guess that’s just another reason to turn Option Strict On&amp;#160; &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/5383.wlEmoticon_2D00_winkingsmile_5F00_31ADE790.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1801661" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quark #5: C is for Char</title><link>http://msmvps.com/blogs/bill/archive/2011/09/29/vb-quark-5-c-is-for-char.aspx</link><pubDate>Thu, 29 Sep 2011 05:50:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800383</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=1800383</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/29/vb-quark-5-c-is-for-char.aspx#comments</comments><description>&lt;p&gt;Can you pick the problem with this code ? :&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Dim&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; currentChar &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Char&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;For&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; i = 0 &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;To&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; largenumber         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; currentChar = getChar(i)          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; currentChar = &lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#fefff0;" color="#a31515"&gt;&amp;quot;a&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Then&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; count += 1         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Next&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The answer of course is the literal “a” is of type string, not of type Char. Hence currentChar gets implicitly widened to a String to make the expression a string comparison expression. This means a new string is created with the contents of currentChar on each iteration, and the comparison is a string comparison which checks for null strings and empty strings and then does a compare ordinal etc. This is incredibly inefficient.&lt;/p&gt;  &lt;p&gt;If “a” was typed as Char, then the comparison is a simple low level IL compare of the underlying values (int16’s).&lt;/p&gt;  &lt;p&gt;You can use CChar, as in CChar(“a”), but it’s a lot easier just to add the type literal suffix c, eg “a”c&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Dim&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; currentChar &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Char&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;For&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; i = 0 &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;To&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; largenumber         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; currentChar = getChar(i)          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; currentChar = &lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#fefff0;" color="#a31515"&gt;&amp;quot;a&amp;quot;&lt;strong&gt;c&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Then&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; count += 1         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Next&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;The change in this code is about 20 fold performance improvement (run as release build outside of Visual Studio). &lt;strong&gt;That’s a 20 fold increase just by typing one extra letter !!&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This example was based on &lt;a href="http://msmvps.com/blogs/bill/archive/2011/03/10/memory-mapped-files-and-pointers-or-not.aspx" target="_blank"&gt;real sample code where a massive file was being parsed char by char&lt;/a&gt;.&amp;#160; There too, attention to the fine detail showed a massive performance improvement over the original code. It’s often the little things that can make a huge difference.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This VB quark was brought to you by the type literal “c”&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800383" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quark #4: type literals</title><link>http://msmvps.com/blogs/bill/archive/2011/09/26/vb-quark-4.aspx</link><pubDate>Mon, 26 Sep 2011 05:54:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800185</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=1800185</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/26/vb-quark-4.aspx#comments</comments><description>&lt;p&gt;Do you know why you can’t write this code in VB:&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:consolas;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;&lt;span style="font-size:10pt;"&gt;&amp;#160;&amp;#160; Dim&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;font-size:10pt;"&gt;x = 123456789.0123456789&lt;/span&gt; &lt;/span&gt;      &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;Answer: The IDE won’t let you &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/7776.wlEmoticon_2D00_winkingsmile_5F00_7076927B.png" /&gt; &lt;/p&gt;  &lt;p&gt;If you try to write that code the IDE will truncate the number, giving :&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:consolas;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;&lt;span style="font-size:10pt;"&gt;&amp;#160;&amp;#160; Dim&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;font-size:10pt;"&gt;x = 123456789.01234567&lt;/span&gt; &lt;/span&gt;      &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;To include all the decimal places you need to be using the Decimal type. To do this you indicate the constant is of type decimal by adding the suffix D on the end, eg:&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:consolas;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="color:#000000;"&gt;&amp;#160;&amp;#160; &lt;/span&gt;Dim&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;font-size:10pt;"&gt;x = 123456789.0123456789&lt;strong&gt;D&lt;/strong&gt; &lt;/span&gt;&lt;/span&gt;      &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;The reason for this is VB treats numeric literals as of type Double by default if they have a decimal place. If there is no decimal place in the literal then the value is consider to be an Integer (Int32), or if it is too large for an Integer, it’s considered to be a Long (Int64).&lt;/p&gt;  &lt;p&gt;If you want the literal as a type other than Double, Integer or Long you need to either convert using CType, CShort, CSng etc, or add a type literal suffix. The following is the complete list for numeric type literal suffixes in VB:&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="200"&gt;&lt;strong&gt;Suffix&lt;/strong&gt; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;&lt;strong&gt;Type&lt;/strong&gt; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;F&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Single &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;R&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Double&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;D&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Decimal&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;S&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Int16, Short&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;I&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Int32, Integer&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;L&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Int64, Long&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;US&lt;/td&gt;        &lt;td valign="top" width="200"&gt;UInt16, UShort&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;UI&lt;/td&gt;        &lt;td valign="top" width="200"&gt;UInt32, UInteger&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;UL&lt;/td&gt;        &lt;td valign="top" width="200"&gt;UInt64, ULong&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;In case you’re wondering, the “F” for Single is short for &amp;quot;Float”, and the “R” for Double is short for “Real Number”.&lt;/p&gt;  &lt;p&gt;Here’s another example of where you should use type literal suffixes. Consider this code :&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:consolas;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;Dim&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;i1, i2 &lt;/span&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;As&lt;/span&gt;&amp;#160;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000088;"&gt;Int16&lt;/span&gt; &lt;/span&gt;          &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;"&gt;&lt;span style="font-size:10pt;"&gt;&lt;span style="color:#000000;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i1 = &amp;amp;HF0            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i2 = i1 &lt;/span&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;And&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;amp;HFF&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;If you have Option Strict On, the last line will cause a compile time error saying that an implicit conversion from Integer to Short is not allowed. So what is happening here, and why doesn’t the middle line cause the same problem ?&lt;/p&gt;  &lt;p&gt;Well the line i1 = &amp;amp;HF0 compiles fine because the constant &amp;amp;HF0 can be evaluated at compile time, so there’s no problem there. The last line however cannot be evaluated because the variable i1 is not a constant. Try it for yourself if you like: change the declaration of i1 to a Const, and you’ll see the last line&amp;#160; compiles fine with Strict On.&lt;/p&gt;  &lt;p&gt;Because VB can’t evaluate the variable expression at compile time, it uses the default type for numeric constants : Integer (aka Int32). And because a short can be implicitly widened to Int32, the expression on the right hand side becomes an Int32: hence the error.&lt;/p&gt;  &lt;p&gt;In Visual Studio the error correction wizard will suggest converting the entire&amp;#160; expression to an Int16, as such :&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:consolas;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i2 = &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;CShort&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;(i1 &lt;/span&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;And&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;amp;HFF)&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;      &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;But that’s a runtime conversion that isn’t needed if you declare the &amp;amp;HFF constant with the correct type literal suffix S:&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:normal;"&gt;&lt;span style="font-family:consolas;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i2 = i1 &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:10pt;"&gt;&lt;span&gt;&lt;span style="color:#3092b1;"&gt;And&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;amp;HFFS&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;      &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;As you can see, the code correction wizard in Visual Studio doesn’t always provide the best syntax to use, so it really is up to you to know the correct literals to use and apply them.&amp;#160; &lt;/p&gt;  &lt;p&gt;Oh, you may have also noticed there is no type literal suffix for Byte and SByte. I’ll leave that for yet another quark &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/2438.wlEmoticon_2D00_smile_5F00_7F111893.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800185" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quark #3: operator differences in VB/C#</title><link>http://msmvps.com/blogs/bill/archive/2011/09/25/vb-quark-3.aspx</link><pubDate>Sun, 25 Sep 2011 10:20:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800148</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=1800148</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/25/vb-quark-3.aspx#comments</comments><description>&lt;p&gt;Can you spot the problem with this code:&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#000088"&gt;Extension&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;()&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; ToColor(argb &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;UInteger&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Color&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Return&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Color&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;.FromArgb( _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;((argb &amp;amp; &amp;amp;HFF000000) &amp;gt;&amp;gt; &amp;amp;H18, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;), _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;((argb &amp;amp; &amp;amp;HFF0000) &amp;gt;&amp;gt; &amp;amp;H10, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;), _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;((argb &amp;amp; &amp;amp;HFF00) &amp;gt;&amp;gt; 8, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;), _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(argb &amp;amp; &amp;amp;HFF, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;))         &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you said it should be the bitwise And operator not the string concatenation operator give yourself a pat on the back.&amp;#160; The problem here is three fold:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The code is a failed attempt at translating from C#, and &lt;/li&gt;    &lt;li&gt;The project must have Option Strict Off for this code to even compile. &lt;/li&gt;    &lt;li&gt;No testing or unit tests to check if the code&amp;#160; works at runtime. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Sadly this is all too common. The above is in fact a very real example taken from the &lt;a href="http://silverlight.codeplex.com/SourceControl/changeset/view/69327#1516743" target="_blank"&gt;Silverlight Toolkit samples on Codeplex&lt;/a&gt; .&lt;/p&gt;  &lt;p&gt;So the steps to correct this are first be aware of the language equivalents when translating from C# to VB. See the &lt;a href="http://msdn.microsoft.com/en-us/library/czz35az4(v=VS.100).aspx" target="_blank"&gt;MSDN documentation on language equivalents&lt;/a&gt; for a great starting point. And take note of the operator equivalents. Some of the most common operators where people seem to make mistakes are:&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="254"&gt;&lt;strong&gt;operator&lt;/strong&gt; &lt;/td&gt;        &lt;td valign="top" width="74"&gt;&lt;strong&gt;VB&lt;/strong&gt; &lt;/td&gt;        &lt;td valign="top" width="71"&gt;&lt;strong&gt;C#&lt;/strong&gt; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;bitwise And&lt;/td&gt;        &lt;td valign="top" width="74"&gt;And&lt;/td&gt;        &lt;td valign="top" width="71"&gt;&amp;amp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;bitwise Or&lt;/td&gt;        &lt;td valign="top" width="74"&gt;Or&lt;/td&gt;        &lt;td valign="top" width="71"&gt;|&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;bitwise exclusive Or&lt;/td&gt;        &lt;td valign="top" width="74"&gt;XOr&lt;/td&gt;        &lt;td valign="top" width="71"&gt;^&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;Short circuited Boolean And&lt;/td&gt;        &lt;td valign="top" width="74"&gt;AndAlso&lt;/td&gt;        &lt;td valign="top" width="71"&gt;&amp;amp;&amp;amp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;Short circuited Boolean Or&lt;/td&gt;        &lt;td valign="top" width="74"&gt;OrElse&lt;/td&gt;        &lt;td valign="top" width="71"&gt;||&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;equality&lt;/td&gt;        &lt;td valign="top" width="74"&gt;=&lt;/td&gt;        &lt;td valign="top" width="71"&gt;==&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;assignment&lt;/td&gt;        &lt;td valign="top" width="74"&gt;=&lt;/td&gt;        &lt;td valign="top" width="71"&gt;=&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;not equal&lt;/td&gt;        &lt;td valign="top" width="74"&gt;&amp;lt;&amp;gt;&lt;/td&gt;        &lt;td valign="top" width="71"&gt;!=&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;exponent&lt;/td&gt;        &lt;td valign="top" width="74"&gt;^&lt;/td&gt;        &lt;td valign="top" width="71"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;modulus&lt;/td&gt;        &lt;td valign="top" width="74"&gt;Mod&lt;/td&gt;        &lt;td valign="top" width="71"&gt;%&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="254"&gt;string concatenation&lt;/td&gt;        &lt;td valign="top" width="74"&gt;&amp;amp;&lt;/td&gt;        &lt;td valign="top" width="71"&gt;+&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;From the short list above you can see the ^ and &amp;amp; operators have very different meanings in VB compared to C#. Which leads us to items 2 &amp;amp; 3.&lt;/p&gt;  &lt;p&gt;If you are unsure of VB, or are translating and hence have a lot of code that *may* be invalid you can improve catching of these kind of developer mistakes by turning Option Strict On. In the original example, the argb &amp;amp; &amp;amp;HFF000000 would have given the result of a string: argb.ToString followed by –16777216. At runtime this string would then try to be converted to a number and then shifted right, most likely failing.&lt;/p&gt;  &lt;p&gt;So if you turn Option Strict On, you’d immediately get warnings on trying to convert the string to a long. But even once you’ve got it compiling with Strict On, you should test the code. A lot of code you can quickly query in the immediate window, or write unit tests.&lt;/p&gt;  &lt;p&gt;Oh, and the corrected code in this particular case is:&lt;/p&gt; &lt;font style="line-height:normal;"&gt;   &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#000088"&gt;Extension&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;()&amp;gt;         &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; ToColor(argb &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;UInteger&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Color&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Return&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Color&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;.FromArgb( _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;((argb &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;And&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; &amp;amp;HFF000000) &amp;gt;&amp;gt; 24, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;), _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;((argb &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;And&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; &amp;amp;HFF0000) &amp;gt;&amp;gt; 16, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;), _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;((argb &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;And&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; &amp;amp;HFF00) &amp;gt;&amp;gt; 8, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;), _         &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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CType&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(argb &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;And&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; &amp;amp;HFF, &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Byte&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;))         &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For a complete project that fixes the VB samples for the Silverlight Toolkit, see &lt;a href="http://msmvps.com/blogs/bill/archive/2011/08/19/vb-windows-phone-toolkit-aug-11-sample.aspx" target="_blank"&gt;my blog post from last month&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800148" 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/Bug/default.aspx">Bug</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><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quark #2: compiler directives and constants</title><link>http://msmvps.com/blogs/bill/archive/2011/09/24/vb-quark-2.aspx</link><pubDate>Sat, 24 Sep 2011 04:31:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800110</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=1800110</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/24/vb-quark-2.aspx#comments</comments><description>&lt;p&gt;Building upon &lt;a href="http://msmvps.com/blogs/bill/archive/2011/09/24/vb-quark-1.aspx" target="_blank"&gt;VB Quark #1&lt;/a&gt; , did you know you can use compiler directives alongside expressions in constants ?&lt;/p&gt;  &lt;p&gt;&lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;&lt;font style="font-size:10pt;"&gt;#If&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt; CONFIG = &lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#fefff0;" color="#a31515"&gt;&amp;quot;Debug&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Then&lt;/font&gt;&lt;/span&gt;          &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; Const path As String = &amp;quot;Z:\mydebug.sdf&amp;quot;&lt;/font&gt;          &lt;br /&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;#Else&lt;/font&gt;&lt;/span&gt;          &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; path &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;String&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; = &lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#fefff0;" color="#a31515"&gt;&amp;quot;|DataDirectory|\Database1.sdf&amp;quot;&lt;/font&gt;&lt;/span&gt;          &lt;br /&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;#End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;font color="#000000"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; connectionString = &lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#fefff0;" color="#a31515"&gt;&amp;quot;Data Source=&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; &amp;amp; path&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The nice thing about this is as you change the config from Debug to Release, Visual Studio will grey out the parts that aren’t in the current compilation. In the above example, when I do a debug build I’m using my database in Z:\mydebug.sdf, but when I do a release build it automatically uses the database Database1.sdf in the application’s DataDirectory.&lt;/p&gt;  &lt;p&gt;You can use compiler directives pretty much anywhere in your code to replace any code block with another at compile time based on the directives. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800110" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quark #1: constant expressions</title><link>http://msmvps.com/blogs/bill/archive/2011/09/24/vb-quark-1.aspx</link><pubDate>Sat, 24 Sep 2011 03:56:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800108</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=1800108</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/24/vb-quark-1.aspx#comments</comments><description>&lt;p&gt;This quark is more of a did ya know quark about constant expressions in VB. You probably know you can declare a constant expression such :&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; appName &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;String&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; = &lt;/font&gt;&lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#fefff0;font-size:10pt;" color="#a31515"&gt;&amp;quot;My Really Cool App&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;    &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;But did you know you can also do operations in constants ?&lt;/p&gt;  &lt;p&gt;Rather than calculate the area of a circle you can write: &lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt; radius = 4.2         &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; area = &lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Math&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;.PI * radius ^ 2&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;The compiler will calculate the area constant at compile time. This makes it easy to change the area constant by simply changing the radius.&lt;/p&gt;  &lt;p&gt;The operations you can do include all the standard mathematical operations : +, –, /, \, * , ^ and Mod as well as bitwise operations such as And and Or as well as bit shifting &amp;lt;&amp;lt; and &amp;gt;&amp;gt;.&lt;/p&gt;  &lt;p&gt;For example you can declare an enum for bits using shift operations: (note: Enums are constants)&lt;/p&gt;  &lt;p&gt;&lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Enum&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;bits&lt;/font&gt;&lt;/span&gt;          &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bit0 = 1           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bit1 = 1 &amp;lt;&amp;lt; 1            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bit2 = 1 &amp;lt;&amp;lt; 2            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; bit3 = bit2 &amp;lt;&amp;lt; 1            &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Enum&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You can also use the If operator. For example you might want to limit a constant based on another constant, eg if gravity is greater than 20g’s then you might want to limit it to 20g for calculations.&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; workingG = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(g &amp;lt; 20 * 9.8, g, 20 * 9.8)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;    &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;And you can also do conversions between the intrinsic numeric types, eg CDbl, CSng, CDec, CLng, CInt, CShort, CByte, CULng,&amp;#160; CUInt, CUShort, CSByte. And conversions to and from boolean to the numeric types: CBool and the aforementioned conversion operators.&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Const&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; roughArea &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Int32&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;CInt&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(area)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;    &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;For dates, there aren’t any operations or conversions you can do: you have to define them using the literal representation in US format, eg today 24/9/2011 is defined as #9/24/2011# . This is still a lot better than certain other languages (not picking on C#) that don’t support constant date literals.&lt;/p&gt;  &lt;p&gt;For strings, you can’t do any conversions but can use the concatenation operator &amp;amp;. You can use + instead of &amp;amp;, but I don’t recommend that (more on that in another quark). Strings that are compiled as constants are also typically interned.&lt;/p&gt;  &lt;p&gt;Anywhere you use an expression that can be compiled as a constant, it is evaluated at compile time: you don’t have to declare a constant variable to reap the benefits of compile time evaluation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800108" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quark #0 : lambda expressions and statements</title><link>http://msmvps.com/blogs/bill/archive/2011/09/23/vb-quark-0.aspx</link><pubDate>Fri, 23 Sep 2011 01:43:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800051</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=1800051</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/23/vb-quark-0.aspx#comments</comments><description>&lt;p&gt;This VB Quark is the one that started the conversation some weeks back. It’s number 0, both because these days things are typically 0 based in .NET, and also you could say it is ground zero. It’s about a &lt;span style="text-decoration:line-through;"&gt;quirk&lt;/span&gt; quark to do with lambda functions versus lambda subs.&lt;/p&gt;  &lt;p&gt;Let’s say you have a Customer class that has an Approved property : &lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;&lt;font style="font-size:10pt;"&gt;Class&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;         &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Property&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; Approved &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#3092b1"&gt;&lt;span&gt;Boolean&lt;/span&gt;           &lt;br /&gt;&lt;span&gt;End&lt;/span&gt;&lt;/font&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Class&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;   &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now if you were to write the following code on a list of Customer, what would you expect to happen ?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customers.ForEach(&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(cust) cust.Approved = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;True&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;     &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you said nothing, you’d be pretty close to the answer.&lt;/p&gt;  &lt;p&gt;The &lt;span style="text-decoration:line-through;"&gt;quirk&lt;/span&gt; quark here is two fold. First of, ForEach expects an Action(Of T) to be passed to it. Action(Of T) in this case has the form of:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Sub&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; DoAction(cust &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;)         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span style="background-image:none;background-attachment:scroll;background-repeat:repeat;background-position:0% 0%;"&gt;&lt;font style="background-color:#e6ffe6;" color="#008000"&gt;&amp;#39;code here&lt;/font&gt;&lt;/span&gt;        &lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size:10pt;" color="#3092b1"&gt;Sub&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;But note we passed in a Function. Function’s have return types. In this case the return type is a Boolean implied from the expression &lt;span style="color:#000000;"&gt;&lt;span class="identifier"&gt;cust&lt;/span&gt; .&lt;span class="identifier"&gt;Approved&lt;/span&gt; =&lt;/span&gt;&lt;span class="keyword"&gt;&lt;span style="color:#3092b1;"&gt;True&lt;/span&gt; &lt;/span&gt;. That is the = operator is an equality operation in this case, not an assignment operator. The original expression is seen by the compiler as the equivalent of : &lt;/p&gt;  &lt;p&gt;&lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customers.ForEach(&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:10pt;"&gt;&lt;font color="#000000"&gt;(cust)           &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;&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; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Return&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; cust.Approved = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;True&lt;/font&gt;&lt;/span&gt;          &lt;br /&gt;&lt;font color="#000000"&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;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you actually want to set the IsApproved values in the ForEach you can simply use a Sub instead of a Function:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;font style="line-height:normal;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:10pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customers.ForEach(&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:10pt;"&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;Sub&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(cust) cust.Approved = &lt;/font&gt;&lt;span&gt;&lt;font color="#3092b1"&gt;True&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;    &lt;br /&gt;&lt;/font&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So the quarks to remember here are the = operator in VB can be either equality test or assignment depending on the context; and not all lambdas are lambda expressions (aka Functions),&amp;#160; some can be lambda statements (aka Sub)&lt;/p&gt;  &lt;p&gt;I’ve seen this quark trip up a couple of really smart people, usually when they are translating code from C# to VB. Apparently some translation tools also make the same mistake. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800051" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>VB Quarks …</title><link>http://msmvps.com/blogs/bill/archive/2011/09/23/vb-quarks.aspx</link><pubDate>Fri, 23 Sep 2011 01:40:08 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1800050</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=1800050</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/23/vb-quarks.aspx#comments</comments><description>&lt;p&gt;A few weeks ago I was having a discussion about a particular language feature that was causing a couple of people to trip up in their code. From that discussion we identified some places where the VB compiler and IDE can possibly help in the future; but for today there are some language features that often go unseen but combined do matter (geek pun intended).&lt;/p&gt;  &lt;p&gt;So I’ve decided to put together a series of posts I’m calling VB Quarks.&amp;#160; The things I’ll be covering are your gotchya’s, the easy to forget things, the little things that combined matter (oh sorry same sad pun again &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/7217.wlEmoticon_2D00_winkingsmile_5F00_79543E98.png" /&gt; ).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1800050" 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/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/VB+Quarks/default.aspx">VB Quarks</category></item><item><title>Windows Phone Mango and multiple google calendars</title><link>http://msmvps.com/blogs/bill/archive/2011/09/22/windows-phone-mango-and-multiple-google-calendars.aspx</link><pubDate>Thu, 22 Sep 2011 01:35:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1799979</guid><dc:creator>bill</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/bill/rsscomments.aspx?PostID=1799979</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/09/22/windows-phone-mango-and-multiple-google-calendars.aspx#comments</comments><description>&lt;p&gt;With Windows Phone 7.5 (aka Mango) &lt;a href="http://windowsteamblog.com/windows_phone/b/windowsphone/archive/2011/09/21/where-s-mango-an-update-on-timing.aspx" target="_blank"&gt;being released in the next couple of weeks&lt;/a&gt;, you may have to work around a google limitation to get multiple google calendars on your device. Both Windows Phone 7.5 and google calendar allow you to have multiple calendars on your phone, but for whatever reason Google doesn’t let you see how to set that unless you trick it to think you’re using an iPad or iPhone. (shame on you google &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/3225.wlEmoticon_2D00_winkingsmile_5F00_16BBE18E.png" /&gt; )&lt;/p&gt;  &lt;p&gt;To trick google, you just need to change your browser user agent string. The steps are:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;setup your google account on your phone as normal and sync with calendar and email. This will give you only the one google calendar for that account.      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Next open up IE 9 on your desktop or laptop computer, press F12 to bring up the IE developer tools. Click on the developer tools &lt;strong&gt;Tools&lt;/strong&gt; menu and select &lt;strong&gt;Change user agent string –&amp;gt; Custom&amp;#160; &lt;/strong&gt;      &lt;br /&gt;      &lt;br /&gt;Add this user agent string:       &lt;br /&gt;&lt;font style="background-color:#cccccc;"&gt;Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10        &lt;br /&gt;        &lt;br /&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;Next browse to &lt;a href="http://m.google.com/sync" target="_blank"&gt;http://m.google.com/sync&lt;/a&gt; and log in to your google account. You should now see your windows phone device listed. Click on that and choose which of your google calendars to sync &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/2502.wlEmoticon_2D00_smile_5F00_0A4DBE65.png" /&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Kudos to &lt;a href="http://wonderreader.tumblr.com/post/7360213627/multiple-google-calendars-windows-phone" target="_blank"&gt;Anthony Chu who posted how to do this with Safari&lt;/a&gt;.     &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1799979" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category><category domain="http://msmvps.com/blogs/bill/archive/tags/WP7/default.aspx">WP7</category></item><item><title>VB Windows Phone Toolkit Aug 11 sample</title><link>http://msmvps.com/blogs/bill/archive/2011/08/19/vb-windows-phone-toolkit-aug-11-sample.aspx</link><pubDate>Fri, 19 Aug 2011 12:57:20 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1797890</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=1797890</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/08/19/vb-windows-phone-toolkit-aug-11-sample.aspx#comments</comments><description>&lt;p&gt;The &lt;a href="http://silverlight.codeplex.com/releases/view/71550" target="_blank"&gt;Silverlight Windows Phone Toolkit August 2011 (7.1 SDK)&lt;/a&gt; doesn&amp;#39;t contain a working VB sample.&amp;#160; If you try to load the VB sample that does ship, you’ll get hundreds of errors.&amp;#160; So I put together the VB sample that should have shipped.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://skydrive.live.com/?cid=73b8e1011c9738b5&amp;amp;sc=documents&amp;amp;id=73B8E1011C9738B5%21169#" target="_blank"&gt;Download the VB Windows Phone Toolkit samples&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Enjoy &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/4370.wlEmoticon_2D00_smile_5F00_2FC4FCFE.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Oh, and Thanks to &lt;a href="http://nicksnettravels.builttoroam.com/" target="_blank"&gt;Nick Randolph&lt;/a&gt; for confirming the SDK doesn’t contain a &lt;em&gt;working&lt;/em&gt; example. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1797890" 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/Silverlight/default.aspx">Silverlight</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/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category></item><item><title>Remember variant ?</title><link>http://msmvps.com/blogs/bill/archive/2011/07/28/remember-variant.aspx</link><pubDate>Thu, 28 Jul 2011 03:40:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1796831</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=1796831</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/07/28/remember-variant.aspx#comments</comments><description>&lt;p&gt;Cory is continuing &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx" target="_blank"&gt;his posts about VB10 differences from VB6&lt;/a&gt;. His latest posts is on &lt;a href="http://addressof.com/blog/archive/2011/07/27/VB10-vs-VB6_3A00_-Variants-are-not-supported_2E00_.aspx" target="_blank"&gt;variants&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Variants were/are basically a structure that contains a variant type enumeration and either the variable’s data value or a pointer to the variable data. In pseudo code it basically looks like:&lt;/p&gt;  &lt;p&gt;Structure Variant   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Public VT as VariantType    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Public Value As Object    &lt;br /&gt;End Structure&lt;/p&gt;  &lt;p&gt;The Value field would hold the actual data in the case of simple value types, or a&amp;#160; pointer to the object such as in the case of arrays. In the .NET world there are actually variant structures but not as part of the .Net framework: you can find one for example in the Microsoft.VisualStudio.Package namespace.&lt;/p&gt;  &lt;p&gt;The reason you won’t find it in the framework is because the variant structure is not only limited but also superfluous in .NET due to the type system. Take for example the case of a value as a Double versus an Integer. In VB6 you would use Variant to allow you to pass both values to a method. The Value field would hold the actual data so it was important that the VT field told you the value type. The problem with this approach is the VT field is an enumeration, so doesn’t allow for custom value types to have their actual type discoverable: try passing a UDT into a variant and then determining which type of UDT is is in VB6 to see what I mean &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/7610.wlEmoticon_2D00_winkingsmile_5F00_7A0C27DC.png" /&gt;&lt;/p&gt;  &lt;p&gt;In .NET the object based type system means you can always determine the type of a variable. So the “everything stems from Object” approach in .NET is definitely more versatile.&lt;/p&gt;  &lt;p&gt;There was however one thing missing: yep, IsMissing was missing. Variants allow optional parameters to indicate if a value was missing. The first release of .Net didn’t have anything in place to indicate if an optional parameter was missing. It wasn’t until nullable types were added that you could do the equivalent of IsMissing by testing for Is Nothing. The Is Nothing approach is more holistic and uniform (as opposed to IsEmpty versus IsMissing et al) and works across the board for nullable types and As Object variables and parameters.&lt;/p&gt;  &lt;p&gt;So, in summary, there was initially some gains and some losses with the move from Variant to an Object based system, but as the .NET framework and language implementations have matured, the Object based system (.NET) offers far more functionality and flexibility.&lt;/p&gt;  &lt;p&gt;Oh, as you can probably see, the above explanation/description actually touches on a number of items in &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx" target="_blank"&gt;the list&lt;/a&gt; Cory referred to: in particular but not limited to items 11 and 27. I think it is always important to come up for air and see the big picture: the forest from the trees. The overall benefits of moving to Object based in .NET extend far beyond these one or two items.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1796831" 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/.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/.NET+4.0/default.aspx">.NET 4.0</category></item><item><title>a little help for volunteers</title><link>http://msmvps.com/blogs/bill/archive/2011/07/28/a-little-help-for-volunteers.aspx</link><pubDate>Thu, 28 Jul 2011 01:31:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1796827</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=1796827</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/07/28/a-little-help-for-volunteers.aspx#comments</comments><description>&lt;p&gt;Today Microsoft announced an even more generous program designed to help non-profit organisations !!   &lt;br /&gt;    &lt;br /&gt;&lt;a title="http://blogs.technet.com/b/microsoftupblog/archive/2011/07/26/expanding-microsoft-software-donations-to-more-nonprofits.aspx" href="http://blogs.technet.com/b/microsoftupblog/archive/2011/07/26/expanding-microsoft-software-donations-to-more-nonprofits.aspx"&gt;http://blogs.technet.com/b/microsoftupblog/archive/2011/07/26/expanding-microsoft-software-donations-to-more-nonprofits.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Kudos guys!!!!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/7356.wlEmoticon_2D00_smile_5F00_3480367B.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1796827" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/Life/default.aspx">Life</category><category domain="http://msmvps.com/blogs/bill/archive/tags/DevCenter/default.aspx">DevCenter</category></item><item><title>Great Ocean Walk photos added</title><link>http://msmvps.com/blogs/bill/archive/2011/07/21/great-ocean-walk-photos-added.aspx</link><pubDate>Thu, 21 Jul 2011 05:28:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1796505</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=1796505</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/07/21/great-ocean-walk-photos-added.aspx#comments</comments><description>&lt;p&gt;Last weekend we strolled around Glen Aire, along the Great Ocean Walk from Castle Cove to Johanna:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://picasaweb.google.com/lh/photo/Fox48g5GPs3mHjj26XVocw?feat=embedwebsite"&gt;&lt;img src="https://lh6.googleusercontent.com/-kpzVJNF2068/TieteUKRplI/AAAAAAAADKc/Kk0yEmIOFek/s640/Castle%252520Cove%252520to%252520Johanna%2525201.JPG" width="640" height="480" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;More photos at:   &lt;br /&gt;&lt;a title="https://picasaweb.google.com/Bill.McCarthy.MVP/GreatOceanWalk#" href="https://picasaweb.google.com/Bill.McCarthy.MVP/GreatOceanWalk#"&gt;https://picasaweb.google.com/Bill.McCarthy.MVP/GreatOceanWalk#&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1796505" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/Life/default.aspx">Life</category></item><item><title>Dell XPS 17 (L702x) review</title><link>http://msmvps.com/blogs/bill/archive/2011/07/02/dell-xps-17-l702x-review.aspx</link><pubDate>Sat, 02 Jul 2011 04:37:42 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1795589</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=1795589</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/07/02/dell-xps-17-l702x-review.aspx#comments</comments><description>&lt;p&gt;I recently bought a Dell XPS17 (L702x) and thought I’d post a review for those considering purchasing this notebook. There’s a &lt;a href="http://forum.notebookreview.com/dell-xps-studio-xps/562138-dell-xps-17-l702x-thread.html" target="_blank"&gt;massive thread&lt;/a&gt; about all things good and bad in relation to this notebook over on notebook forums; the following is just my opinion&lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/4863.wlEmoticon_2D00_smile_5F00_70502E47.png" /&gt;&lt;/p&gt;  &lt;p&gt;Weight : good for the size.&lt;/p&gt;  &lt;p&gt;Screen: Love it !!&amp;#160; I have the anti-glare screen (1920 x 1080) and it’s a lovely screen. I did make minor adjustments to the gamma, toned the blue down a bit and the green just a tad. &lt;a href="http://picasaweb.google.com/Bill.McCarthy.MVP" target="_blank"&gt;Photos, especially nature scenes&lt;/a&gt;, look fantastic, true to life colours. The antiglare is also really good. Compared side by side with a glossy screen laptop you really appreciate how well it works: no&amp;#160; annoying reflections of windows etc. Viewing angle is really wide with little distortion.&lt;/p&gt;  &lt;p&gt;Keyboard: It’s growing on me, but i think it could be better. I like the back light. Problem with the keyboard being a full keyboard is it means centre of the keyboard is off centre, which means i tend to have the laptop shifted out to my right. Given how much space there is I think Dell could have done better with keyboard options, such as offer a comfort curve option.&lt;/p&gt;  &lt;p&gt;Touchpad: It’s big. Also off to the left a bit so as to almost be centre of the alpha part of the keyboard, but not quite. Centre of the touchpad lines up with key 7 or the space between Y and U. Gestures work pretty well: I particularly like the cover the touchpad to hide all open windows gesture.&lt;/p&gt;  &lt;p&gt;RAM is 8 GB which is good enough for me (generally). Unfortunately only 2 slots. Apparently if you order the 3D screen you get 4 slots. That kind-of sucks, but i doubt it will bother me in the next couple of years.&lt;/p&gt;  &lt;p&gt;Processor: i7 2630QM. Seems good and fast. Yet to really multi thread stress test it though. &lt;/p&gt;  &lt;p&gt;Graphics: most of the time I’m using the Intel one (or so it seems). I’m not a gamer &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/2766.wlEmoticon_2D00_winkingsmile_5F00_2795F3DC.png" /&gt;&lt;/p&gt;  &lt;p&gt;USB: Awesome !! My external HD which is USB 3, is fast &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/4863.wlEmoticon_2D00_smile_5F00_70502E47.png" /&gt;&amp;#160; I also really like the charge port for charging my phone.&lt;/p&gt;  &lt;p&gt;Battery: I got the 9 cell. i like how it sticks out of the bottom to tilt the notebook when sitting at a table. Battery life seems good. I use the machine for hours and still have half battery left.&lt;/p&gt;  &lt;p&gt;Hard drives: There’s two bays and came with two 750 GB @ 7200 RPM. I found them relatively noisy and kind-of slow, so I put in one of my old solid state drives and also added a new OCZ Vertex 3. The Vertex 3 uses the 6 Gbs bus and it rocks !! Lightning fast, and absolutely no noise. There was a problem with the notebook hanging for anywhere up to 30 seconds or so. Looking in the windows log I identified the problem as being the Intel SATA drivers so I uninstalled them, and since then it has been rock solid (and very fast &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/4863.wlEmoticon_2D00_smile_5F00_70502E47.png" /&gt; )&lt;/p&gt;  &lt;p&gt;Sadly the Dell web site doesn’t really give much choice on this: they don’t tell you what kind of Solid State Drive they offer as far as performance goes, and they only offer pricey options of 256 GB or more. Given this notebook has two internal drive bays, having two @120 GB would seem the best bang for your buck at present. My OCZ HD is getting the maximum windows experience index score of 7.9:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/8306.image_5F00_2CAE3D83.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/1346.image_5F00_thumb_5F00_50C37245.png" width="708" height="213" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Overall opinion: I like it &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/2860.wlEmoticon_2D00_openmouthedsmile_5F00_19B38814.png" /&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1795589" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/bill/archive/tags/Life/default.aspx">Life</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Design/default.aspx">Design</category></item><item><title>Private Class Variables</title><link>http://msmvps.com/blogs/bill/archive/2011/07/02/private-class-variables.aspx</link><pubDate>Sat, 02 Jul 2011 02:06:32 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1795588</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=1795588</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/07/02/private-class-variables.aspx#comments</comments><description>&lt;p&gt;&lt;font size="2"&gt;Cory Smith has &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx" target="_blank"&gt;a set of posts on some of the differences between VB6 and VB10.&lt;/a&gt;There’s one which I think needs a bit further clarification: &lt;a href="http://addressof.com/blog/archive/2011/06/04/VB10-vs-VB6_3A00_-Private-Class-Variables-.aspx" target="_blank"&gt;Private Class Variables.&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;In VB7 and later, you can access private class variables from another instance of the class. So let’s say you had a class A with a private field _z, and instances a1 and a2.In this case a2 can read and modify a1._z.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;An example of this might be if you have a class that has a private field to track changes; you might expose whether or not the class has changes as a ReadOnly property, but you’d want the backing field as Private so as it can’t be modified from outside the class, e.g:&lt;/font&gt;&lt;/p&gt;  &lt;pre style="line-height:normal;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;&lt;font style="font-size:8.4pt;"&gt;Class&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:8.4pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="VB USER TYPES - IDENTIFIER - (TRANSIENT)"&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Private&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;_hasChanges&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Boolean&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Private&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;_FirstName&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;String&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:8.4pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;ReadOnly&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Property&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;HasChanges&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Boolean&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Get&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Return&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;_hasChanges&lt;/span&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Get&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Property&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; &lt;br /&gt; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Property&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;FirstName&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;String&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Get&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Return&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;_FirstName&lt;/span&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Get&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Set&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(&lt;span class="identifier"&gt;value&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;String&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;)&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;value&lt;/span&gt; &amp;lt;&amp;gt; &lt;span class="identifier"&gt;_FirstName&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Then&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span style="background-image:none;padding-bottom:0px;padding-left:0px;background-attachment:scroll;padding-right:0px;background-repeat:repeat;background-position:0% 0%;overflow:visible;padding-top:0px;" class="comment"&gt;&lt;font style="background-color:#e6ffe6;" color="#008000"&gt;&amp;#39;TODO: Raise PropertyChanging notification&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="identifier"&gt;_hasChanges&lt;/span&gt; = &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;True&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="identifier"&gt;_FirstName&lt;/span&gt; = &lt;span class="identifier"&gt;value&lt;/span&gt;&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; &lt;/font&gt;&lt;span style="background-image:none;padding-bottom:0px;padding-left:0px;background-attachment:scroll;padding-right:0px;background-repeat:repeat;background-position:0% 0%;overflow:visible;padding-top:0px;" class="comment"&gt;&lt;font style="background-color:#e6ffe6;" color="#008000"&gt;&amp;#39;TODO: Raise PropertyChanged notification&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;If&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Set&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Property&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; &lt;br /&gt; &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Shared&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;Clone&lt;/span&gt;(&lt;span class="identifier"&gt;source&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="VB USER TYPES - IDENTIFIER - (TRANSIENT)"&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="VB USER TYPES - IDENTIFIER - (TRANSIENT)"&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Dim&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;cust&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;As&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;New&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="VB USER TYPES - IDENTIFIER - (TRANSIENT)"&gt;&lt;font color="#000088"&gt;Customer&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="identifier"&gt;cust&lt;/span&gt;.&lt;span class="identifier"&gt;_FirstName&lt;/span&gt; = &lt;span class="identifier"&gt;source&lt;/span&gt;.&lt;span class="identifier"&gt;_FirstName&lt;/span&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span class="identifier"&gt;cust&lt;/span&gt;.&lt;span class="identifier"&gt;_hasChanges&lt;/span&gt; = &lt;span class="identifier"&gt;source&lt;/span&gt;.&lt;span class="identifier"&gt;_hasChanges&lt;/span&gt;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Return&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:8.4pt;"&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;span class="identifier"&gt;cust&lt;/span&gt;&lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;Function&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;br /&gt;&lt;span class="keyword"&gt;&lt;font color="#3092b1"&gt;End&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;span class="keyword"&gt;&lt;font style="font-size:8.4pt;" color="#3092b1"&gt;Class&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;br /&gt;&lt;/pre&gt;

&lt;p&gt;&lt;font size="2"&gt;Note the Clone function, where the code has access to the private variable of a second instance. This makes the language a lot more powerful and flexible. Benefits include:&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="2"&gt;access to fields in Shared methods&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;provide deep clone and equality methods&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Assists with Factory methods&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="2"&gt;there’s no real downside to this, as only code written in the same class as the field&amp;#160; is defined in can modify the field. Code in derived classes would need the field to be declared as Protected, not Private, so Private remains Private to the code you write.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;In terms of VB6 to VB7+, this is a non breaking change.&amp;#160; It was an addition to the language that makes a lot of sense as the language moved to be more object orientated.&amp;#160; So to claim that this is somehow significant impeding change is really just &lt;strong&gt;nonsense&lt;/strong&gt;: zero impact on existing code, and provides greater flexibility when writing new code.&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1795588" 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/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/bill/archive/tags/Design/default.aspx">Design</category></item><item><title>Windows Phone 7 : 6 months later</title><link>http://msmvps.com/blogs/bill/archive/2011/06/17/windows-phone-7-6-months-later.aspx</link><pubDate>Fri, 17 Jun 2011 07:29:55 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1794861</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=1794861</wfw:commentRss><comments>http://msmvps.com/blogs/bill/archive/2011/06/17/windows-phone-7-6-months-later.aspx#comments</comments><description>&lt;p&gt;I’ve had my HTC Mozart for about 6 months now, so I thought I’d give an update of my thoughts about it and Windows Phone 7.&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://www.microsoft.com/windowsphone/en-us/features/update-schedule-world.aspx" target="_blank"&gt;first set of WP7 updates&lt;/a&gt; were really slow to roll-out here in Australia to Telstra: Telstra was the 2nd last mobile operator to deliver the update in the world. Given that the Spain’s Telefonica apparently still is only scheduling updates, for now Telstra has the honour of actually being last to deliver the updates (to date). Despite those middle party delays, the 7.1 update was awesome !&amp;#160; Performance improvements are huge with some applications, and most importantly we got cut and paste back.&lt;/p&gt;  &lt;p&gt;For more feature improvements we still have to wait until later this year when the “Mango” update will be released. Developers &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=11321" target="_blank"&gt;can play with the mango bits&lt;/a&gt; in Visual Studio and the phone emulator. So far Mango looks really cool and addresses many of my initial/early concerns about Windows Phone.&amp;#160; Looking at my “xmas wish list” of 3 items, that list seems at least half way addressed :&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Sensors&lt;/strong&gt;: Yes, in Mango the platform exposes more of the phone’s sensors.&amp;#160; &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/4442.wlEmoticon_2D00_smile_5F00_495A559C.png" /&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Content Providers&lt;/strong&gt;: Again it seems like Microsoft has heard and is exposing ways for applications to work with the contacts list etc.&amp;#160; At the same time they are also introducing “groups” for contacts which may in itself address many of the reasons I want/need to have the contacts list exposed. hopefully groups too will be exposed to programmatic access (with permissions). There still doesn’t appear to be any shared storage/data access on the phone.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Let me work with my PC&lt;/strong&gt; : Sadly, I haven’t heard any news on this front; everything I have heard has been focused on a better “cloud” experience. It’s a pity as there are times when there is no internet access, and it would be handy to transfer files &amp;amp; contacts to the phone. Zune really needs to open up to include basic file management; and ideally outlook synchronisation. This is a MUST have given the lack of Zune music in Australia. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So that was my old list. Today some of the things I’d like to see Mango address are (in no particular order):&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Capacitive button settings:        &lt;br /&gt;&lt;/strong&gt;Way too often I find I accidentally hit the home, search or back buttons, especially when passing the phone to other people to show them something on the phone. It’s be nice if there was a settings page where you could modify the sensitivity of these buttons. Ideally I’d like to be able to set them to only work on double click/touch. It’s a little thing, but it would drastically change the way I feel about the phone’s physical form factor. It’d make it feel like the phone was truly mine, rather than the phone constantly dictating to me not to touch it there, and not to hold it that way &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/bill.metablogapi/6136.wlEmoticon_2D00_winkingsmile_5F00_5FCCF423.png" /&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;iCal and/or vCal support:        &lt;br /&gt;&lt;/strong&gt;A month or two ago I got an email from some of the crew at Microsoft to attend a Live Meeting about Windows Phone.&amp;#160; “Cool !!” I thought. The problem was I read that email on my phone, and couldn’t save the attached calendar appointment !&amp;#160; Oh the irony !!!!       &lt;br /&gt;Must be able to send and receive calendar appointments via email.       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;vCard support:        &lt;br /&gt;&lt;/strong&gt;There needs to be a way to simply share contact details with people. VCard support in email and especially SMS is a must have.       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Better document handling:        &lt;br /&gt;&lt;/strong&gt;The ability to:       &lt;br /&gt;+ simply save a document from an email,       &lt;br /&gt;+ transfer files directly to/from a PC       &lt;br /&gt;+ programmatically generate and save documents (e.g. invoices/quotes etc.) in shared locations. Ditto for data access.       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Zune music:        &lt;br /&gt;&lt;/strong&gt;If Microsoft wants people in Australia to take it seriously about its commitment to Windows Phone it needs to invest in actually having Zune Music available here (ditto for other countries). ITunes has no problem with providing music in Australia. Microsoft: either make Zune Music in Australia happen or open the phone up to 3rd party music sites and file organisation (iTunes on the Windows Phone !!) or both. It’s really crappy to lock the phone down and then not provide the service. Even worse when you open Zune and it constantly reminds you there is no service here. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;   &lt;br /&gt;Despite the list of “wants” or “shortcomings”, Windows Phone really is a nice device. The UI is generally enjoyable (as long as you don’t accidentally hit those capacitive buttons &amp;lt;g&amp;gt;).&amp;#160; &lt;a href="http://windowsteamblog.com/windows_phone/b/windowsphone/archive/2011/05/24/microsoft-officially-unveils-mango-hundreds-of-improvements-on-the-way.aspx" target="_blank"&gt;Mango looks even better&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Looking forward to hearing more details. Spaces to watch:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://windowsteamblog.com/windows_phone/b/windowsphone/" target="_blank"&gt;Windows Phone Blog&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/" target="_blank"&gt;Windows Phone Developer Blog&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1794861" 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/VB10/default.aspx">VB10</category><category domain="http://msmvps.com/blogs/bill/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://msmvps.com/blogs/bill/archive/tags/WP7/default.aspx">WP7</category></item></channel></rss>
