<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">blue collar</title><subtitle type="html">a blog by dan elliott.</subtitle><id>http://blogs.msdn.com/b/bluecollar/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/bluecollar/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2007-02-08T02:52:00Z</updated><entry><title>A Few of My Favorite Things...in Visual Studio 2010</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2011/03/06/a-few-of-my-favorite-things-in-visual-studio-2010.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2011/03/06/a-few-of-my-favorite-things-in-visual-studio-2010.aspx</id><published>2011-03-06T01:46:00Z</published><updated>2011-03-06T01:46:00Z</updated><content type="html">&lt;!--CTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt--&gt;
&lt;p&gt;
&lt;meta content="text/html; charset=utf-8" /&gt;

&lt;/p&gt;
&lt;table bgcolor="#b0c4de"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Since my last post I've switched from Visual Studio 2008/.Net 3.5 to VS 2010/.Net 4.0 for most of my day-to-day work.&amp;nbsp; I haven't had time to explore them thoroughly, but there are a couple of things that I really like.&lt;/p&gt;
&lt;p&gt;The first is that optional parameters have been added to C#.&amp;nbsp; There haven't been many concepts that I've missed in the move from C++ to C# but optional parameters was one of them.&amp;nbsp; No longer do I have to have to write a series of functions to supply default parameters like this:&lt;/p&gt;
&lt;pre&gt;public void foo()
{
    foo(false);
}

public void foo(boolean onOffSwitch)
{
    ...
}&lt;/pre&gt;
&lt;p&gt;I can now achieve the same result like this:&lt;/p&gt;
&lt;pre&gt;public void foo(boolean onOffSwitch = false)
{
    ...
}&lt;/pre&gt;
&lt;p&gt;The second is the historical debugger.&amp;nbsp; This feature allows you to step back through the events that have occurred in your application to find the context for a failure.&amp;nbsp; There is an &lt;a href="http://geekswithblogs.net/michelotti/archive/2009/02/05/c-4.0-optional-parameters.aspx"&gt;episode&lt;/a&gt; of the 10-4 show on Channel 9 gives a nice, concise explanation of how to use the feature, so I won't go into details.&lt;/p&gt;
&lt;p&gt;A third feature that I find useful is the ability to generate a database from an entity model.&amp;nbsp; I find it much easier to think about the data I need to manipulate as business objects rather than data tables, particularly when I need to model many-to-many relationships.&amp;nbsp; With this feature, I create a new ADO.NET Entity Data Model, design the entities that I need conceptually, and Visual Studio will generate the DDL for creating the database.&amp;nbsp; Now, I'm not a database analyst by profession, so I can't speak to the quality of the generated database; however, for the type of databases I usually need, it works great.&amp;nbsp; Take a look at the &lt;a href="http://channel9.msdn.com/Shows/10-4/10-4-Episode-15-Model-First-Development-with-the-Entity-Framework-40"&gt;Model-First Development with the Entity Framework 4.0&lt;/a&gt; episode of 10-4 on Channel9 or &lt;a href="http://msdn.microsoft.com/en-us/data/ff628199"&gt;Julie Lerman's tutorial&lt;/a&gt; on MSDN.&lt;/p&gt;
&lt;p&gt;If you've found features that you like (or don't) in VS 2010, leave a comment to let me know what they are.&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;Dan&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;DISCLAIMER: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. &lt;/strong&gt;&lt;/small&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10137329" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="tips" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/tips/" /><category term="Visual Studio 2010" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/Visual+Studio+2010/" /></entry><entry><title>AssemblyFileVersionAttribute and AssemblyVersionAttribute: A subtle difference</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2011/01/12/assemblyfileversionattribute-and-assemblyversionattribute-a-subtle-difference.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2011/01/12/assemblyfileversionattribute-and-assemblyversionattribute-a-subtle-difference.aspx</id><published>2011-01-12T03:04:00Z</published><updated>2011-01-12T03:04:00Z</updated><content type="html">&lt;table bgcolor="#b0c4de"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;The AssemblyInfo.cs file generated by Visual Studio contains the following lines: &lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;// Version information for an assembly consists of the &lt;br /&gt;// &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;following four values:&lt;br /&gt;//&lt;br /&gt;// Major Version&lt;br /&gt;// Minor Version &lt;br /&gt;// Build Number&lt;br /&gt;// Revision&lt;br /&gt;//&lt;br /&gt;// You can specify all the values or you can default the Build &lt;br /&gt;// &lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;and Revision Numbers&lt;br /&gt;// by using the '*' as shown below:&lt;br /&gt;// [assembly: AssemblyVersion("1.0.*")] &lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;[assembly: AssemblyVersion("1.0.0.0")]&lt;br /&gt;[assembly: AssemblyFileVersion("1.0.0.0")] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I was trying to auto-increment the build number by changing them like this:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;[assembly: AssemblyVersion("1.0.*")]&lt;br /&gt;[assembly: AssemblyFileVersion("1.0.*")] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;However, when I looked at the properties dialog for my executable, the file version was "1.0.*". &lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-69-82/4062.Untitled-picture.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;This puzzled me until I came across Manfred Lange's (&lt;a href="http://manfredlange.blogspot.com/"&gt;&lt;strong&gt;Manni on DotNet&lt;/strong&gt;&lt;/a&gt;) very clear explanation of the difference between these attributes and how to use them effectively to auto-increment assembly version numbers. &lt;a href="http://manfredlange.blogspot.com/2009/08/assemblyfileversionattribute-and.html"&gt;Worth a read&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;Dan &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;small&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;DISCLAIMER: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer.&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;/small&gt; &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10114481" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="tips" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/tips/" /></entry><entry><title>Visual Studio Tip of the Day</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2010/11/30/visual-studio-tip-of-the-day.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2010/11/30/visual-studio-tip-of-the-day.aspx</id><published>2010-11-30T18:06:00Z</published><updated>2010-11-30T18:06:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table bgcolor="#b0c4de"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;I want to give a quick shout-out to &lt;a href="http://saraford.net/"&gt;Sara Ford&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/b/zainnab"&gt;Zain Naboulsi&lt;/a&gt; for their great Visual Studio tips.&amp;nbsp; If you use VS in your day-to-day work, you owe it to yourself to browse these blogs: there's sure to be a thing or five that will save you time and effort.&amp;nbsp; I believe there are about 400 tips at present...and new ones coming every day.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;Here are a few of my favorites:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://saraford.net/2008/04/10/did-you-know-you-can-drag-and-drop-code-onto-the-toolbox-general-tab-191/"&gt;&lt;strong&gt;&lt;em&gt;Dragging-and-dropping code onto the toolbox's General tab&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; Discovering this was revolutionary.&amp;nbsp; Whether it's code that I use infrequently (e.g., an implementation of the IDisposable pattern) or something that I know I'll need to insert several times in the next few minutes, it's handy.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://saraford.net/2008/10/09/did-you-know-you-can-keep-recently-used-files-from-falling-off-the-file-tab-channel-331/"&gt;&lt;strong&gt;&lt;em&gt;Keeping recently used files from falling off the file tab channel&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; Oh, how I hate to have to find the file I was &lt;span style="font-style: italic;"&gt;just&lt;/span&gt; using in a dropdown list or Solution Explorer.&amp;nbsp; This keeps files ordered by usage rather than the order they were opened...and saves my sanity. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://saraford.net/2008/11/11/did-you-know-you-can-press-ctrl-d-to-view-the-code-definition-window-354/"&gt;&lt;strong&gt;&lt;em&gt;Pressing Ctrl+D opens the Code Definition window&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; Until I read this tip, I didn't know there was a Code Definition window.&amp;nbsp; I love being able to view definitions and declarations without leaving the code I'm working on. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://saraford.net/2007/10/26/did-you-know-ctrlf3-searches-for-the-currently-selected-string-without-brining-up-the-find-window-070/"&gt;&lt;strong&gt;&lt;em&gt;Searching for the currently selected string without bringing up the Find window&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; Now the Find window can't cover the code I need to look at. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/zainnab/archive/2010/11/30/document-outline-windows-form-projects-vstiptool0118.aspx"&gt;&lt;strong&gt;&lt;em&gt;Viewing your project in the Document Outline window&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; I no longer have to scroll through the dropdown in the Properties window to find that control that missing control. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/zainnab/archive/2010/10/24/show-external-code-vstipdebug0031.aspx"&gt;&lt;strong&gt;&lt;em&gt;Displaying external function names in the Call Stack window&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; If, like me, you do a lot of managed/native interop, this is invaluable.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://saraford.net/2007/07/27/did-you-know-how-to-do-box-column-selection-in-the-editor-002/"&gt;&lt;strong&gt;&lt;em&gt;Selecting a box of text&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&amp;nbsp; Great for indenting columns in the middle of a table of data.&lt;/li&gt;
&lt;/ul&gt;
So thanks Sara and Zain for the great work!&amp;nbsp; Please, please, please keep it up...&lt;br /&gt;&lt;br /&gt;As always, please leave a comment if you find this article useful.&lt;br /&gt;&lt;br /&gt;Cheers&lt;br /&gt;Dan&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;small&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;span style="font-size: x-small;"&gt;DISCLAIMER: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer.&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;/span&gt;&lt;/small&gt; &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10098509" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="Visual Studio" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/Visual+Studio/" /><category term="tips" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/tips/" /></entry><entry><title>Poor Man's Guide Lines for Visual Studio's Windows Forms Editor</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2010/11/30/poor-man-s-guide-lines-for-visual-studio-s-windows-forms-editor.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2010/11/30/poor-man-s-guide-lines-for-visual-studio-s-windows-forms-editor.aspx</id><published>2010-11-30T05:36:00Z</published><updated>2010-11-30T05:36:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table bgcolor="#b0c4de"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;ul style="margin-left:.0208in;direction:ltr;unicode-bidi:embed;margin-top:
 0in;margin-bottom:0in"&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;The custom control I've been working on required drawing custom shapes on each side of the control.&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;The shapes needed to be the same size and I was sure that one was a couple of pixels shorter than the other, but it was difficult to tell with the naked eye.&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;I was wishing that the WinForms editor in VS 2008 had something like Photoshop's Guides: horizontal and vertical lines that can be placed over the image to aid alignment.&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;&amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-69-82/0243.clip_5F00_image001.png" border="0" /&gt;&lt;/p&gt;
&lt;p style="margin:0in"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;Since the real issue was to create an edge that I could use to judge the length of my graphics, I pulled a panel on to the form and stretched it across the control.&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;That worked okay, but the panel was still 8 pixels high and I often had to move it when I resized my form or control.&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;The former was solved easily enough by setting the height of the panel to 1 in the Properties window, but now it was very difficult to get a grip on when I needed to move it.&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;Then it occurred to me that if I anchored the panel to the sides it would stretch as the form stretched.&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;Shazam!&lt;span style="mso-spacerun:yes"&gt;&amp;nbsp; &lt;/span&gt;Instant guidelines.&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-69-82/4834.clip_5F00_image002.png" border="0" /&gt;&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;At some point I'll write a macro to do this automagically, but this is good enough for now.&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;If you find this useful, let me know.&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;Cheers&lt;/p&gt;
&lt;p style="margin:0in;font-family:Calibri;font-size:11.0pt"&gt;Dan&lt;/p&gt;
&lt;/ul&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;small&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;DISCLAIMER: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer.&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;/small&gt; &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10098129" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="design-time" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/design_2D00_time/" /><category term="tips" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/tips/" /></entry><entry><title>Why does retrieving resources have to be so difficult?  Oops, it's not...</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2010/11/01/why-does-retrieving-resources-have-to-be-so-difficult-oops-it-s-not.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2010/11/01/why-does-retrieving-resources-have-to-be-so-difficult-oops-it-s-not.aspx</id><published>2010-11-01T01:59:00Z</published><updated>2010-11-01T01:59:00Z</updated><content type="html">&lt;table bgcolor="#b0c4de"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Loading embedded resources at runtime has always mystified me.&amp;nbsp; Should I use the ComponentResourceManager class?&amp;nbsp; Should I try to find the ResourceStream in the assembly?&amp;nbsp; And what's the correct name to use to identify it?&amp;nbsp; Is it simply the file name? Or is it the name of the default namespace plus the filename?&amp;nbsp; Or do I need to specify the assembly name and the filename?&amp;nbsp; And I don't do it often enough to remember how I did it the last time.&amp;nbsp; Arrrrrggggghhh! &lt;/p&gt;
&lt;p&gt;Well, I finally realized that I don't need to jump through all of those hoops: any resource that is added to the Resources.resx file can be accessed by name through Properties.Resources.&amp;nbsp; For instance, if I add an icon named Hiho.ico to Resources.resx,&amp;nbsp; I can reference it via Properties.Resources.Hiho.&amp;nbsp; No muss, no fuss! &lt;/p&gt;
&lt;p&gt;A couple of things are worth noting here.&amp;nbsp; First, the name that matters is the resource identifier in Resource.resx, not the file name.&amp;nbsp; By default, Visual Studio uses the base file name of the resource as the resource identifier.&amp;nbsp; However, the resource identifier and the file name need not match.&amp;nbsp; For instance, if there is already a resource identifier with that name, Visual Studio will create a new resource identifier by appending a digit to the base file name.&amp;nbsp; Or you might have a co-worker with a perverse sense of humor who decides to rename all of the resources with the names of Disney characters. &lt;/p&gt;
&lt;p&gt;The second item of interest (to me, at least) is a bit more esoteric: the resources aren't listed in the assembly manifest.&amp;nbsp; If you simply add the Hiho.ico file to your project and mark it as an embedded resource, you'll see an entry in the manifest like this after you build: &lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mresource public Foo.Resources.Hiho.ico&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;However, if you add it to the Resources.resx file without including it as an Embedded object, this line won't appear in the manifest.&amp;nbsp; If you know why this is, please leave me a comment. &lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;Dan &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;&lt;small&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;DISCLAIMER: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer.&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt;&lt;bold&gt;&lt;/bold&gt; &lt;/small&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10083811" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term=".net resources" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/-net+resources/" /></entry><entry><title>C# Extension Methods: Syntactic Sugar or Useful Tool?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2010/10/25/c-extension-methods-syntactic-sugar-or-useful-tool.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2010/10/25/c-extension-methods-syntactic-sugar-or-useful-tool.aspx</id><published>2010-10-25T06:28:00Z</published><updated>2010-10-25T06:28:00Z</updated><content type="html">&lt;table bgcolor="#b0c4de"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p&gt;Last week a colleague introduced me to extension methods (&lt;a href="http://msdn.microsoft.com/en-us/library/bb383977.aspx"&gt;C#&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/bb384936.aspx"&gt;VB&lt;/a&gt;) in .Net. If you're not familiar with extension methods, they were added in Visual Studio 2008 to provide a means for adding functionality to existing types without creating a new derived type. Extension methods are called as if they were instance methods of the existing type. For example, if I wanted to know how many vowels there were in a string, I could add a &lt;code&gt;VowelCountEx&lt;/code&gt; method to the &lt;code&gt;String&lt;/code&gt; class like this: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    static class ExtensionMethods
    {
        public static int VowelCountEx(this String value)
        {
            char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u' };
            int count = 0;
            foreach (char ch in value)
            {
                if (vowels.Contains(ch))
                {
                    count++;
                }
            }
            return count;
        }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the function is displayed by Intellisense as if it was a member function, &lt;/p&gt;
&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-69-82/5001.image1.png" border="1" /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and I can then call it like this: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    class Program
    {
        static void Main(string[] args)
        {
            string value = "my string";
            int count = value.VowelCountEx();
        }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(By the way, I&amp;rsquo;m &lt;strong&gt;&lt;em&gt;&lt;span style="text-decoration: underline;"&gt;not&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt; advocating appending &lt;code&gt;Ex&lt;/code&gt; to the names of extension method: I simply want it to be clear that &lt;code&gt;VowelCountEx&lt;/code&gt; is an extension method.) &lt;/p&gt;
&lt;p&gt;My initial reaction was &amp;lsquo;Sweet!'. However, after thinking about it for a couple of days (no, my brain &lt;span style="text-decoration: underline;"&gt;doesn&amp;rsquo;t&lt;/span&gt; work very fast), I began to wonder if there was anything more to this than hiding the &lt;code&gt;this&lt;/code&gt; reference. I could achieve the same functionality like this: &lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static class ExtensionMethods&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static int VowelCountEx(String value)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u' };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int count = 0;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (char ch in value)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (vowels.Contains(ch))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return count;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Program&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string value = "my string";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int count = ExtensionMethods.VowelCountEx(value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Other than the method showing up in Intellisense for the type, extension methods hadn't added anything. I was sure there must be something more.&amp;nbsp; Maybe the compiler was doing something under the hood? So I compiled the following code and opened the resulting executable in ILDasm. (The non-extension method has been renamed to &lt;code&gt;VowelCount&lt;/code&gt; to differentiate it from &lt;code&gt;VowelCountEx&lt;/code&gt;.) &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    static void Main(string[] args)
    {
        string value = "my string";
        int count = value.VowelCountEx();
        count = ExtensionMethods.VowelCount(value);
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here's the resulting IL: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    .method private hidebysig static void  Main(string[] args) cil managed
    {
      .entrypoint
      // Code size       22 (0x16)
      .maxstack  1
      .locals init ([0] string 'value',
               [1] int32 count)
      IL_0000:  nop
      IL_0001:  ldstr      "my string"
      IL_0006:  stloc.0
      IL_0007:  ldloc.0
      IL_0008:  call       int32 Test2.ExtensionMethods::VowelCountEx(string)
      IL_000d:  stloc.1
      IL_000e:  ldloc.0
      IL_000f:  call       int32 Test2.ExtensionMethods::VowelCount(string)
      IL_0014:  stloc.1
      IL_0015:  ret
    } // end of method Program::Main
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So there really isn't any functional difference between extension methods and normal static methods. &lt;/p&gt;
&lt;p&gt;If, then,&amp;nbsp;extension methods are essentially syntactic sugar, should they be used? This comes back to one of the basic principles of clear communication: consistency. If you are going to use extension methods, use them everywhere; if you are going to use normal static methods, do that everywhere. But please, please, please don't mix the two. One of my pet peeves when trying to understand a new code base is inconsistency because it means that I constantly have to&amp;nbsp;either look elsewhere in&amp;nbsp;the code or in the documentation (if any) to discover how to use it.&amp;nbsp; Mixing extension methods and static methods is certain to cause confusion.&lt;/p&gt;
&lt;p&gt;The biggest advantage to extension methods is discoverability: when I type my variable name in an Intellisense-aware editor, the extension methods are added to the list. In contrast, when using a normal static method, I have to remember the name of the class that implements it in order to call it. Another plus is the ability to 'extend' sealed classes and valuetypes. I often find that BCL valuetypes don't have the conversions that I need.&amp;nbsp; Now, I can add the conversion and have it display in Intellisense.&amp;nbsp; A third is that they integrate seamlessly with generics. This is not an essential, but it sure comes in handy sometimes.&amp;nbsp; Finally, my code will no longer be littered with calls to &lt;code&gt;StringHelper.This()&lt;/code&gt; and &lt;code&gt;ControlHelper.That()&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;There are also a couple of things I don't like. Adding the &lt;code&gt;this&lt;/code&gt; modifier to the function signature is really confusing if you haven't seen it before. The first time I saw it, I thought it was a syntax error.&amp;nbsp; Imagine my surprise when it compiled!&amp;nbsp; However, instead of compiling the code, I could have simply 'fixed' the syntax error.&amp;nbsp; Then when I compiled I would have seen a syntax error like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;code&gt;'Program' does not contain a definition for 'CountVowelsEx' and no extension method 'CountVowelsEx' accepting a first argument of type 'String' could be found (are you missing a using directive or an assembly reference?)&lt;/code&gt;&lt;/blockquote&gt;
&lt;p&gt;Hmmm...there's nothing wrong with the static method because I fixed the syntax error.&amp;nbsp; Why won't this #$!$!#$#$ file compile?&amp;nbsp; A second issue I have with extension methods is that they can pollute Intellisense--thus frustrating their biggest advantage. Since extension methods are inherited by all derived classes, deeply derived classes can end up with so many methods that it's difficult to find the one you're looking for.&amp;nbsp; However, my biggest beef is that the differences between static and instance methods are no longer obvious in the calling function. Consider the following code: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    static void Main(string[] args)
    {
        string value = null;
        int count = value.Length;
        count = value. VowelCountEx();
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What happens when &lt;code&gt;value.Length&lt;/code&gt; is called? The CLR runtime throws a &lt;code&gt;NullReferenceException&lt;/code&gt; immediately: the &lt;code&gt;get_Length&lt;/code&gt; function is never called because there is no object through which to reference it. However, when &lt;code&gt;value.VowelCountEx()&lt;/code&gt; is called, the code jumps to the function and begins executing. The &lt;code&gt;NullReferenceException&lt;/code&gt; isn't thrown until the enumerator for the object is accessed in the &lt;code&gt;foreach&lt;/code&gt; statement. If you understand that &lt;code&gt;VowelCountEx&lt;/code&gt; is actually a static method, this makes perfect sense; however, there is no way to tell this by examining the code in the calling function. This type of subtle difference causes maintenance developers to tear their hair out because the reason isn't obvious. (If you've ever spent time debugging a problem hidden in someone else's C/C++ macro, you know what I'm talking about.)&amp;nbsp;&amp;nbsp;A corollary to this is that I never need to add a null check for the calling object in an instance method because the object must be valid; however, I do have to add one to an extension method (if the extended object is a reference type) because there is no such guarantee. &lt;/p&gt;
&lt;p&gt;So my answer is yes to both questions: extension methods are syntactic sugar but they can be useful syntactic sugar.&amp;nbsp; For myself, I'm going to begin using extension methods because I like the discoverability and understand the potential pitfalls. However, I'm going to give myself this advice: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use either&amp;nbsp;extension methods or regular static methods to extend class functionality, but not both. &lt;/li&gt;
&lt;li&gt;Be aware that a call to an extension method is a call to a static method, not an instance method. &lt;/li&gt;
&lt;li&gt;Keep the code for extension methods in close proximity to the classes they extend so that I'm reminded to update them when I make changes to the original class. If you want to keep all extension methods in a single class but still achieve proximity, use partial classes. &lt;/li&gt;
&lt;li&gt;Check for null objects in extension methods that operate on reference types. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If I've missed any pros or cons, please post a comment-discussion is good for the soul. &lt;/p&gt;
&lt;p&gt;Cheers,&lt;br /&gt;Dan &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;small&gt;&lt;strong&gt;
&lt;hr width="90%" style="text-align: left; width: 90%;" /&gt;
&lt;/strong&gt;&lt;/small&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;DISCLAIMER: &lt;br /&gt;The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. &lt;/strong&gt;&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/small&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10080239" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="extension methods" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/extension+methods/" /></entry><entry><title>Hiding a non-virtual property for a derived control at design-time</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2010/10/23/hiding-a-non-virtual-property-for-a-derived-control-at-design-time.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2010/10/23/hiding-a-non-virtual-property-for-a-derived-control-at-design-time.aspx</id><published>2010-10-23T21:17:00Z</published><updated>2010-10-23T21:17:00Z</updated><content type="html">&lt;p&gt;I've recently been developing a custom control (&lt;code&gt;BarControl&lt;/code&gt;) that derived from an existing control (&lt;code&gt;FooControl&lt;/code&gt;). There were two requirements related to the derived control's border style: 
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;BorderStyle&lt;/code&gt; property should not be modified at runtime&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;BorderStyle&lt;/code&gt; property should not be displayed in the Properties pane at design-time&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since the base control exposed a &lt;code&gt;BorderStyle&lt;/code&gt; property, I thought I'd need to do three things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;override the property &lt;/li&gt;
&lt;li&gt;change it's access modifier to &lt;code&gt;protected&lt;/code&gt; so that only derived classes can access it &lt;/li&gt;
&lt;li&gt;add a &lt;code&gt;[Browsable(false)]&lt;/code&gt; attribute to remove it from Visual Studio's Properties pane &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So I blithely whipped out the following code: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    [Browsable(false)]
    protected override BorderStyle BorderStyle
    {
        get { return base.BorderStyle; }
        set { base.BorderStyle = value; }
    }
    &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The compiler just as blithely hit me with the following error: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    Error 1  'BarControl.BorderStyle.get': cannot override inherited member 'FooControl.BorderStyle.get' because it is not marked virtual, abstract, or override
    Error 2  'BarControl.BorderStyle.set': cannot override inherited member 'FooControl.BorderStyle.set' because it is not marked virtual, abstract, or override
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Oops! I had expected the&amp;nbsp;&lt;code&gt;BorderStyle&lt;/code&gt; property to be virtual and it wasn't. The solution--like most solutions--was obvious once I found it: use the &lt;code&gt;new&lt;/code&gt;, rather than the &lt;code&gt;override&lt;/code&gt;, modifier to hide the base class property. So I quickly changed the code to: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    [Browsable(false)]
    protected &lt;span style="background-color: #ffff00;"&gt;new&lt;/span&gt; BorderStyle BorderStyle
    {
        get { return base.BorderStyle; }
        set { base.BorderStyle = value; }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the compiler was happy, so everything would work as expected, right? I switched to my test app, drug an instance of my control onto a form, and looked for the &lt;code&gt;BorderStyle&lt;/code&gt; property in the Properties pane. Lo and behold, it was still there. I was stumped. I had hidden the base property and marked the new property with &lt;code&gt;[Browsable(false)]&lt;/code&gt;. What could be wrong? &lt;/p&gt;
&lt;p&gt;It took a close reading of the documentation for the &lt;code&gt;new&lt;/code&gt; modifier to find the problem: the &lt;code&gt;new&lt;/code&gt; modifier overrides members with the same &lt;em&gt;signature&lt;/em&gt;. Since the access modifier is part of a member's signature, changing the access modifier from &lt;code&gt;protected&lt;/code&gt; to &lt;code&gt;public&lt;/code&gt; meant I wasn't hiding the &lt;code&gt;BorderStyle&lt;/code&gt; property in the base class. As a result, the &lt;code&gt;BrowsableAttribute&lt;/code&gt; was applied to the &lt;code&gt;BorderStyle&lt;/code&gt; property in the derived class but not the &lt;code&gt;BorderStyle&lt;/code&gt; property in the base class. &lt;/p&gt;
&lt;p&gt;What to do. I needed to hide the &lt;code&gt;BorderStyle&lt;/code&gt; property at design time, so I needed to make it &lt;code&gt;public&lt;/code&gt; in the derived class; however, I also needed to hide the property at runtime so I needed to make it &lt;code&gt;protected&lt;/code&gt;. Perhaps, I could apply the &lt;code&gt;protected&lt;/code&gt; access modifier to the property's getter and setter methods while still leaving the property access modifier as &lt;code&gt;public&lt;/code&gt;. So I tried this: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    [Browsable(false)]
    &lt;span style="background-color: #ffff00;"&gt;public&lt;/span&gt; new BorderStyle BorderStyle
    {
        &lt;span style="background-color: #ffff00;"&gt;protected&lt;/span&gt; get { return base.BorderStyle; }
        &lt;span style="background-color: #ffff00;"&gt;protected&lt;/span&gt; set { base.BorderStyle = value; }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The compiler didn't like it: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    Error 1  Cannot specify accessibility modifiers for both accessors of the property or indexer 'BarControl.BorderStyle'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since the goal was to keep the property from being modified at runtime, I settled on the following solution: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    [Browsable(false)]
    public new BorderStyle BorderStyle
    {
        &lt;span style="background-color: #ffff00;"&gt;get&lt;/span&gt; { return base.BorderStyle; }
        protected set { base.BorderStyle = value; }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm not sure that there isn't a better solution, but this meets the criteria: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;BorderStyle&lt;/code&gt; property is not displayed in the Properties pane at design-time &lt;/li&gt;
&lt;li&gt;The &lt;code&gt;BorderStyle&lt;/code&gt; property cannot be modified at runtime &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So the three things I actually needed to do were&lt;/p&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;hide the property in the base class with the &lt;code&gt;new&lt;/code&gt; modifier&lt;/li&gt;
&lt;li&gt;change the access modifier of the property's setter method to &lt;code&gt;protected&lt;/code&gt; so that only derived classes can access it &lt;/li&gt;
&lt;li&gt;add a &lt;code&gt;[Browsable(false)]&lt;/code&gt; attribute to the derived class property to remove it from Visual Studio's Properties pane &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;p&gt;I hope you find this helpful. &lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;Dan&lt;/p&gt;
&lt;p&gt;Disclaimer: This posting is provided &amp;quot;AS IS&amp;quot; with no warranties, and confers no rights.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10079967" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="design-time" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/design_2D00_time/" /></entry><entry><title>Back in Business</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2010/10/23/back-in-business.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2010/10/23/back-in-business.aspx</id><published>2010-10-23T19:12:00Z</published><updated>2010-10-23T19:12:00Z</updated><content type="html">&lt;p style="text-align: left;"&gt;After a hiatus of 3+ years, I've decided to reopen blue collar.&amp;nbsp; The focus will no longer be the .Net Compact Framework, but will still be aimed at providing information and solutions that will save time and effort for developers delivering solid code on a daily basis.&amp;nbsp; If you find these articles useful, please let me know; if you find that the explanations aren't clear or that information is missing, please let me know that as well.&lt;/p&gt;
&lt;p style="text-align: left;"&gt;Cheers,&lt;br /&gt;Dan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10079947" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Adding Compact Framework Design-Time Attributes, or More Fun With TextBoxes</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2007/02/08/adding-compact-framework-design-time-attributes-or-more-fun-with-textboxes.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2007/02/08/adding-compact-framework-design-time-attributes-or-more-fun-with-textboxes.aspx</id><published>2007-02-08T22:41:00Z</published><updated>2007-02-08T22:41:00Z</updated><content type="html">&lt;p style="text-align: left;"&gt;A common user-interface feature is to select the contents of a text-box when the textbox gets focus. The CF textbox control doesn't do this by default but it's not difficult to add with managed code. While I'm at it, I'll add a SelectTextOnFocus property to the textbox's property window so the developer can determine at design-time whether or not to use this functionality. &lt;/p&gt;
&lt;p style="text-align: left;"&gt;The code is trivial: I simply override the OnGotFocus() method and add a call to SelectAll(). However, there is one interesting point: the call to SelectAll() must come after the call to the base class's OnGotFocus() method. Otherwise, the base class will undo the selection. &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
    public class DerivedTextBox : TextBox
    {
        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            this.SelectAll();
        }
    }
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;Adding the SelectAllOnFocus property is trivial as well. &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
    public class DerivedTextBox : TextBox
    {
        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            if (this.selectAllOnFocus)
            {
                this.SelectAll();
            }
        }

        private bool selectAllOnFocus = false;
        public bool SelectAllOnFocus
        {
            get { return this.selectAllOnFocus; }
            set { this.selectAllOnFocus = value; }
        }
    }
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;Unfortunately, adding design-time properties for the Compact Framework is not. (I could devote an entire article to the things I dislike about the Compact Framework designer support, probably entitled &lt;i&gt;&lt;span style="text-decoration: underline;"&gt;Compact Should NOT Mean More Difficult&lt;/span&gt;&lt;/i&gt;).&lt;/p&gt;
&lt;p style="text-align: left;"&gt;In the full .NET framework, design-time behavior is added by decorating properties with design-time attributes. For instance, to make the property appear in the Properties window, the Browsable attribute is added to the property like this: &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
        [Browsable(true)]
        public bool SelectAllOnFocus
        {
            get { return this.selectAllOnFocus; }
            set { this.selectAllOnFocus = value; }
        }
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;I like this because it keeps everything I need to know about a property in a single place. However, the classes that support the design-time attributes were removed from the Compact Framework because design-time work is not done on devices. As a result, the code above would no longer compile. This meant that an alternate method was needed for specifying design-time attributes for device applications. The solution chosen was to put the attributes in...drum roll, please...a separate XML file. And, naturally, a new XML file means a new schema (XMTA). For purposes of this article, I will use the term 'XMTA file' to refer to this type of file. &lt;/p&gt;
&lt;p style="text-align: left;"&gt;There are two ways that I know of to create an XMTA file. The first is described in &lt;a href="http://msdn2.microsoft.com/en-us/library/ms180789(VS.80).aspx"&gt;Walkthrough: Adding a Simple Attribute to a User Control&lt;/a&gt;. Since there is no documentation (other than %vsinstalldir%\Xml\Schemas\xmta.xsd) describing the schema, this was how I created my first XMTA file. The second method is to edit the XMTA file directly in the Visual Studio editor. I prefer this method because Intellisense can give some guidance as to what tags are valid. To do this, I &lt;/p&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;create an XML file with a .xmta extension&lt;/li&gt;
&lt;li&gt;add the following boiler-plate code:
&lt;pre&gt;&lt;code&gt;
    &amp;lt;?xml version="1.0" encoding="utf-16"?&amp;gt;
    &amp;lt;Classes xmlns="http://schemas.microsoft.com/VisualStudio/2004/03/SmartDevices/XMTA.xsd"&amp;gt;
      &amp;lt;Class Name="MyNamespace.MyClass"&amp;gt;
        &amp;lt;Property Name="MyProperty"&amp;gt;
          &amp;lt;!-- TODO: enter attributes --&amp;gt;
        &amp;lt;/Property&amp;gt;
      &amp;lt;/Class&amp;gt;
    &amp;lt;/Classes&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;change the Class and Property names to match those in my project&lt;/li&gt;
&lt;li&gt;type an open bracket (&amp;lt;) under the TODO comment and Intellisense will display a list of attributes that can be applied to the property.&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="text-align: left;"&gt;After adding the Browsable attribute to my SelectAllOnFocus property, the XMTA file looks like this: &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
    &amp;lt;?xml version="1.0" encoding="utf-16"?&amp;gt;
    &amp;lt;Classes xmlns="http://schemas.microsoft.com/VisualStudio/2004/03/SmartDevices/XMTA.xsd"&amp;gt;
      &amp;lt;Class Name="DeviceApplication1.DerivedTextBox"&amp;gt;
        &amp;lt;Property Name="SelectAllOnFocus"&amp;gt;
          &amp;lt;Browsable&amp;gt;true&amp;lt;/Browsable&amp;gt;
        &amp;lt;/Property&amp;gt;
      &amp;lt;/Class&amp;gt;
    &amp;lt;/Classes&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;After I compile my project, return to the design window, and drag a new DerivedTextBox object onto my form, I should see the SelectAllOnFocus property in the control's property window. &lt;/p&gt;
&lt;p style="text-align: left;"&gt;If I view the properties in categories, I'll see that SelectAllOnFocus is listed in the Misc category. It would be nice to have it show up in the Behavior category. This is done by adding a Category attribute to the property in the XMTA file. &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
        &amp;lt;Property Name="SelectAllOnFocus"&amp;gt;
          &amp;lt;Browsable&amp;gt;true&amp;lt;/Browsable&amp;gt;

          &lt;b&gt;&amp;lt;Category&amp;gt;Behavior&amp;lt;/Category&amp;gt;&lt;/b&gt;

        &amp;lt;/Property&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;Adding a Description attribute will cause descriptive text to be displayed below the Properties list. &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
        &amp;lt;Property Name="SelectAllOnFocus"&amp;gt;
          &amp;lt;Browsable&amp;gt;true&amp;lt;/Browsable&amp;gt;
          &amp;lt;Category&amp;gt;Behavior&amp;lt;/Category&amp;gt;

          &lt;b&gt;&amp;lt;Description&amp;gt;Determines whether the contents of the control should be selected when focus is moved to the control.&amp;lt;/Description&amp;gt;&lt;/b&gt;

        &amp;lt;/Property&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;Finally, the default value for the property can be specified by adding a DefaultValue attribute. This attribute requires that the value and its type be specified by inner tags: &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
        &amp;lt;Property Name="SelectAllOnFocus"&amp;gt;
          &amp;lt;Browsable&amp;gt;true&amp;lt;/Browsable&amp;gt;
          &amp;lt;Category&amp;gt;Behavior&amp;lt;/Category&amp;gt;
          &amp;lt;Description&amp;gt;Determines whether the contents of the control should be selected when focus is moved to the control.&amp;lt;/Description&amp;gt;

          &lt;b&gt;&amp;lt;DefaultValue&amp;gt;
            &amp;lt;Type&amp;gt;bool&amp;lt;/Type&amp;gt;
            &amp;lt;Value&amp;gt;false&amp;lt;/Value&amp;gt;
          &amp;lt;/DefaultValue&amp;gt;&lt;/b&gt;

        &amp;lt;/Property&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;Though the process of adding my property to the Properties list was more convoluted than I'd like, I can now set the value of the SelectAllOnFocus property at design time and Visual Studio will generate code like this to initialize it. &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
        private void InitializeComponent()
        {
          ...
            this.derivedTextBox1 = new DeviceApplication1.DerivedTextBox();
          ...
            // 
            // derivedTextBox1
            // 
            this.derivedTextBox1.Location = new System.Drawing.Point(33, 109);
            this.derivedTextBox1.Name = "derivedTextBox1";

            &lt;b&gt;this.derivedTextBox1.SelectAllOnFocus = false;&lt;/b&gt;

            this.derivedTextBox1.Size = new System.Drawing.Size(100, 21);
            this.derivedTextBox1.TabIndex = 1;
            this.derivedTextBox1.Text = "derivedTextBox1";
          ...
            this.Controls.Add(this.derivedTextBox1);
          ...
        }
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;I hope this takes a little of the mystery out of adding design-time support to Compact Framework controls. &lt;/p&gt;
&lt;p style="text-align: left;"&gt;Cheers&lt;br /&gt;Dan &lt;/p&gt;
&lt;p style="text-align: left; font-size: 0.7em;"&gt;Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1629281" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="design-time" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/design_2D00_time/" /></entry><entry><title>Setting Alignment in TextBoxes...No Looking Glass Required</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/bluecollar/archive/2007/02/08/setting-alignment-in-textboxes-no-looking-glass-required.aspx" /><id>http://blogs.msdn.com/b/bluecollar/archive/2007/02/08/setting-alignment-in-textboxes-no-looking-glass-required.aspx</id><published>2007-02-08T02:52:00Z</published><updated>2007-02-08T02:52:00Z</updated><content type="html">&lt;p style="text-align: left;"&gt;In yesterday's post I stated that "non-character keys do not trigger KeyPress events." While that is perfectly true, I misunderstood what was meant by a non-character key. In the non-managed Win32 world, pressing a key generates a WM_KEYDOWN, one or more WM_CHAR messages, and a WM_KEYUP message. The managed KeyPress event corresponds to the WM_CHAR message. Windows generates WM_CHAR messages for keys that are mapped to ASCII characters by the keyboard driver. Since pressing the Enter key generates an ASCII character code (0xA, 0xD, or both), a KeyPress event is generated for it.&lt;/p&gt;
&lt;p style="text-align: left;"&gt;So, while the code I posted yesterday works, it can be simplified by eating the Enter key in the textbox's KeyPress event handler rather than using the form's KeyPreview.&lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ('\r' == e.KeyChar)
            {
                // Supress enter key
                e.Handled = true;
            }
        }
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;In addition, since the textbox is no longer dependent on the form for functionality, I can package it up in it's own class. &lt;/p&gt;
&lt;pre style="text-align: left;"&gt;&lt;code&gt;
    public class TextBoxWithAlignment : TextBox
    {
        // Remember whether user wants the textbox to act like a 
        // single-line or multiline textbox.
        //
        private bool multiline = false;

        public TextBoxWithAlignment()
        {
            // The underlying control will always be a multiline textbox
            //
            base.Multiline = true;
        }

        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            // When the user wants a single-line textbox,
            // eat carriage returns
            //
            if (!this.multiline &amp;amp;&amp;amp; '\r' == e.KeyChar)
            {
                e.Handled = true;
            }
            base.OnKeyPress(e);
        }

        // Override the Multiline property to use the internal multiline flag
        //
        public override bool Multiline
        {
            get
            {
                return this.multiline;
            }
            set
            {
                this.multiline = value;
            }
        }
    }
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align: left;"&gt;Pretty nifty, IMHO. &lt;/p&gt;
&lt;p style="text-align: left;"&gt;Cheers&lt;br /&gt;Dan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1622639" width="1" height="1"&gt;</content><author><name>Dan Elliott-MSFT</name><uri>http://blogs.msdn.com/BlueCollar/ProfileUrlRedirect.ashx</uri></author><category term="control property" scheme="http://blogs.msdn.com/b/bluecollar/archive/tags/control+property/" /></entry></feed>