<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.NET</title>
        <link>http://www.mostlylucid.co.uk/category/2.aspx</link>
        <description>.NET</description>
        <language>en-US</language>
        <copyright>Scott Galloway</copyright>
        <generator>Subtext Version 2.1.0.5</generator>
        <item>
            <title>John Lam&amp;rsquo;s Dev Kit</title>
            <link>http://mostlylucid.net/archive/2008/09/08/john-lamrsquos-dev-kit.aspx</link>
            <description>&lt;p /&gt;  &lt;p /&gt;  &lt;p&gt;Kind of a &lt;a href="http://www.hanselman.com/tools"&gt;‘tools’ list&lt;/a&gt; but a great post on what &lt;a href="http://www.iunknown.com/2008/08/my-dev-kit.html"&gt;John uses on his machine&lt;/a&gt;…a few new ones I hadn’t seen which is always nice!&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1299.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/09/08/john-lamrsquos-dev-kit.aspx</guid>
            <pubDate>Mon, 08 Sep 2008 22:35:43 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/09/08/john-lamrsquos-dev-kit.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1299.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Premature optimization and user perception...my pet project and CSS Sprites</title>
            <link>http://mostlylucid.net/archive/2008/07/11/spritey.my-pet-project.aspx</link>
            <description>&lt;p&gt;One of the themes I'm looking at for vNext of ASP.NET is the optimization of sites by reducing the number of server requests required for a single page.&lt;br /&gt;
A new classic in the area of improving the perceived performance of your sites by reducing the number of server roundtrips is &lt;a href="http://stevesouders.com/"&gt;Steven Sounders&lt;/a&gt; book &lt;a href="http://www.amazon.com/High-Performance-Web-Sites-Essential"&gt;'High Performance Websites'&lt;/a&gt;. Steven's book is very small, very readable and probably the best book on anything to do with the web that I've read in years.&lt;br /&gt;
This book was a huge revelation for me...I spent most of my coding career writing the slickest, highest performing code I could...and frankly thinking about the structure of the actualy pages the user sees would've been a better use of my time in a lot of cases. As an example,, &lt;a href="http://www.icslearn.co.uk/"&gt;this was one&lt;/a&gt; of the last sites which I worked on as a full time developer...the code is about the best I ever created, the DB is optimized up the wazoo and I very nearly killed myself trying to make it 'perfect'...but for the hundreds of hours I spent sweating blood over the code you could now spend a couple of thousand dollars on a faster server and improve the performance even more...(even ignoring the fact that it's HUGELY overengineered...even has it's own MVC system and templating feature...hey, I was bored!)&lt;br /&gt;
As servers get faster and programming frameworks get more efficient, the amount of time your web server actually spends processing a page, doing a DB request and whatever else it has to do to generate HTML gets smaller and smaller; with better use of caching, AJAX and other techniques it's likely that you page actually returns it's total content to the user in milliseconds.... You can really only make minimal gains to 'preceived performance' in your sites by optimizing the dynamic code in your web application these days...(and this will likely only reduce over time)&lt;/p&gt;
&lt;p&gt;Welcome to &lt;a href="http://en.wikipedia.org/wiki/Moore's_law"&gt;Moore's law&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The fact is that for 99% of web pages the issue is no longer really about optimizing the amount of time your page takes to return HTML content to the user...it's what happens afterwards which leads to poor download performance.&lt;/p&gt;
&lt;p&gt;The Problem&lt;br /&gt;
&lt;br /&gt;
Websites nowadays have more and more separate elements in a single webpage, images, css, js files, flash content, videos etc...often the number of requests sent from single page can take MANY (as in several orders of magnitude) times longer than the bit we developers commonly fret about. As an example a few seconds ago I requested the &lt;a href="http://www.cnn.com"&gt;CNN&lt;/a&gt; homepage, the actual page of HTML content loaded in 222ms, but the OTHER 153 requests for the rest of the stuff the page needed took a total of 4.65s.&lt;br /&gt;
One way to avoid a large number of these other requests is to combine requests for multiple objects together. In ASP.NET 3.5 SP1 we'll be shipping a feature called &lt;a href="http://www.asp.net/Learn/3.5-SP1/video-296.aspx"&gt;'ASP.NET AJAX Script Combining'&lt;/a&gt;, as the name suggests this feature combines multiple HTTP requests (in this case for the ASP.NET AJAX scripts) into a single request, potentially greatly reducing the number of roundtrips to the server.&lt;br /&gt;
&lt;br /&gt;
Where is this going? &lt;/p&gt;
&lt;p&gt;Well, a feature I've been playing with (and which I'm considering for ASP.NET vNext) is an ASP.NET CSS Sprite Control. Zack Owens has &lt;a href="http://weblogs.asp.net/zowens/archive/2008/03/05/css-sprite-for-asp-net.aspx"&gt;already posted&lt;/a&gt; about a technique for doing this in ASP.NET, but I wanted to increase the usability of generating these sprites; think using an ASP.NET image control and them magically being combined and output as part of a Sprite...&lt;br /&gt;
For those who don't know, &lt;a href="http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/"&gt;CSS Sprites&lt;/a&gt; are essentially a technique which involves combining multiple images into one and using CSS to specify which one to show when they download. With this technique you both reduce the number of server requests as well as 'pre-loading' images on the fly (when's the last time you had an image rollover which seemed to stutter as it loaded the next image?).&lt;br /&gt;
Anyway, that's the idea; below is a some ASP.NET markup I'm playing with...this would resuly in a single PNG image being generated, along with a CSS definition for the sprite and for each 'image' to be displayed in the page.&lt;br /&gt;
This is still very much a work in progress and there's a ton of challenges around persisting the generated image in a scalable way etc...But well, I've been quiet of late so I thought I'd let you know what I'm playing with these days...&lt;br /&gt;
&lt;br /&gt;
&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;html&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;xmlns&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;
&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;head&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;title&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;title&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;cs&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;SpriteManager&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;GroupName&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="DEFAULTGROUP"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ImageFormat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="png"&amp;gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;cs&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;SpriteManager&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;head&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;body&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;form&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;id&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="form1"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;cs&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;Sprite&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Sprite"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ReferenceId&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Clock"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ImageUrl&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="~/icons/Clock.ico"/&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;cs&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;Sprite&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Sprite1"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ReferenceId&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Contacts"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ImageUrl&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="~/icons/contacts 1.ico"/&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;cs&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;Sprite&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Sprite2"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ReferenceId&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Alerts"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ImageUrl&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="~/icons/alerts.ico"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;/&amp;gt;&lt;br /&gt;
&amp;lt;cs:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;Sprite&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Sprite3"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ReferenceId&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Download"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ImageUrl&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="~/icons/download.ico"/&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;cs&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;Sprite&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Sprite4"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ReferenceId&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="Desktop"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="server"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="1"&gt;&lt;font color="#ff0000" size="1"&gt;ImageUrl&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;="~/icons/desktop.ico"&lt;/font&gt;&lt;/font&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;/&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;form&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;body&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;br /&gt;
&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="1"&gt;&lt;font color="#a31515" size="1"&gt;html&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&lt;font color="#0000ff" size="1"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;
 &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1296.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/07/11/spritey.my-pet-project.aspx</guid>
            <pubDate>Sat, 12 Jul 2008 02:54:36 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/07/11/spritey.my-pet-project.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1296.aspx</wfw:commentRss>
        </item>
        <item>
            <title>My secret project....NET 3.5 SP1 Beta (well, the release bit)</title>
            <link>http://mostlylucid.net/archive/2008/05/12/my-secret-project.net-3.5-sp1-beta-well-the-release-bit.aspx</link>
            <description>&lt;p&gt;I should have made this a better post but anyway. &lt;a href="http://blogs.msdn.com/brada"&gt;Brad Abrams&lt;/a&gt; &lt;a href="http://blogs.msdn.com/brada/archive/2008/05/05/visual-studio-2008-and-net-framework-3-5-sp1-beta.aspx#comments"&gt;just posted about the .NET 3.5 SP1 Beta release&lt;/a&gt; .     &lt;br /&gt;We've also posted a bunch of &lt;a href="http://www.asp.net/downloads/3.5-extensions/"&gt;new Screencasts&lt;/a&gt; covering the new features for ASP.NET in this release, as well as a &lt;a href="http://www.asp.net/downloads/3.5-extensions/Readme/"&gt;readme&lt;/a&gt; which has some getting started and upgrade information for migrating from the previous release...&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1279.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/05/12/my-secret-project.net-3.5-sp1-beta-well-the-release-bit.aspx</guid>
            <pubDate>Mon, 12 May 2008 16:53:33 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/05/12/my-secret-project.net-3.5-sp1-beta-well-the-release-bit.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1279.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Grrr...poor use of singletons and a very cool Generic Singleton pattern!</title>
            <link>http://mostlylucid.net/archive/2008/04/30/grrr.poor-use-of-singletons-and-a-very-cool-generic-singleton.aspx</link>
            <description>&lt;p&gt;I &lt;a href="http://www.mostlylucid.net/archive/2008/04/30/changes-afoot.change-to-blogengine.net.aspx"&gt;posted earlier&lt;/a&gt; that I'm switching to &lt;a href="http://www.dotnetblogengine.net/"&gt;blogengine.net&lt;/a&gt;, as part of this I've been fiddling around with the code (as is my way..I'll contribute back to the source when I've finished). One of my major pet hates is poor use of the &lt;a href="http://en.wikipedia.org/wiki/Singleton_pattern"&gt;singleton pattern&lt;/a&gt;, especially as there's a definitive &lt;a href="http://www.yoda.arachsys.com/csharp/singleton.html"&gt;article on the pattern in .NET&lt;/a&gt; and how to do it well. It's actually likely that this pattern is overkill in this case and a &lt;a href="http://www.bluebytesoftware.com/blog/PermaLink,guid,c4ea3d6d-190a-48f8-a677-44a438d8386b.aspx"&gt;ReaderWriterLockSlim&lt;/a&gt; could be better (though it has it's &lt;a href="http://weblogs.asp.net/leftslipper/archive/2008/03/31/mvc-locking-the-routecollection.aspx"&gt;own problems&lt;/a&gt;) . Anyway, on the assumption that a Singleton is the best choice here, let's look at the current code:&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="font-size: 8pt; background: white; color: black; font-family: verdana"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;BlogSettings&lt;/span&gt; Instance&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;get&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {  &lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (blogSettingsSingleton == &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    blogSettingsSingleton = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;BlogSettings&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;return&lt;/span&gt; blogSettingsSingleton;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;If you look at the article I &lt;a href="http://www.yoda.arachsys.com/csharp/singleton.html"&gt;mentioned above&lt;/a&gt; you'll see that this is the version which is specifically called out as follows:&lt;/p&gt;  &lt;p&gt;"&lt;em&gt;the above is not thread-safe. Two different threads could both have evaluated the test &lt;code&gt;if (instance==null)&lt;/code&gt; and found it to be true, then both create instances, which violates the singleton pattern. Note that in fact the instance may already have been created before the expression is evaluated, but the memory model doesn't guarantee that the new value of instance will be seen by other threads unless suitable memory barriers have been passed.&lt;/em&gt;'&lt;/p&gt;  &lt;p&gt;The common 'best' singleton pattern (well, it's debatable...but generally the best...) is a lot more wordy (see version 5 in that article) so I was please to find &lt;a href="http://blog.falafel.com/2008/01/26/AGenericSingleton.aspx"&gt;this post&lt;/a&gt; on a Generic Singleton (actually this &lt;a href="http://www.codeproject.com/KB/cs/genericsingleton.aspx"&gt;was posted a while ago on Codeproject&lt;/a&gt;)...really nice. In the Utils class I added this:&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="font-size: 8pt; background: white; color: black; font-family: verdana"&gt;   &lt;p style="margin: 0px"&gt;    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Provides a Singleton implementation using Generics.&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;typeparam name="T"&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Type of singleton instance&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;sealed&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Singleton&lt;/span&gt;&amp;lt;T&amp;gt; &lt;span style="color: blue"&gt;where&lt;/span&gt; T : &lt;span style="color: blue"&gt;new&lt;/span&gt;()&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            Singleton() { }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; T Instance&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;get&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Nested&lt;/span&gt;.instance;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Nested&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: green"&gt;// Explicit static constructor to tell C# compiler&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: green"&gt;// not to mark type as beforefieldinit&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;static&lt;/span&gt; Nested() { }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;internal&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;readonly&lt;/span&gt; T instance = &lt;span style="color: blue"&gt;new&lt;/span&gt; T();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;The code for returning the instance then becomes:&lt;/p&gt;  &lt;div style="font-size: 8pt; background: white; color: black; font-family: verdana"&gt;   &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;BlogSettings&lt;/span&gt; Instance&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;get&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Utils&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;Singleton&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;BlogSettings&lt;/span&gt;&amp;gt;.Instance;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;You have to also change the constructor for BlogSettings to public to allow this this to work which does let devs shoot themselves in the foot (by ignoring the singleton)  and you of course have to balance the benefit agains that risk...&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1276.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/04/30/grrr.poor-use-of-singletons-and-a-very-cool-generic-singleton.aspx</guid>
            <pubDate>Thu, 01 May 2008 05:42:20 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/04/30/grrr.poor-use-of-singletons-and-a-very-cool-generic-singleton.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1276.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Why do single chances make me nervous...life should come with an undo function...</title>
            <link>http://mostlylucid.net/archive/2008/04/15/why-do-single-chances-make-me-nervous.life-should-come-with.aspx</link>
            <description>&lt;p&gt;Spent most of the day not doing what I should've been doing. I have a number of balls in the air at the moment and it feels like I've just added a spinning plate act at the same time...noisy disaster may ensue. Right now I'm working on another &lt;a href="http://www.codeplex.com/aspnet"&gt;Codeplex&lt;/a&gt; release, working on a private build of some beta bits for the &lt;a href="www.aspinsiders.com"&gt;Insiders&lt;/a&gt;, getting our bugs migrated to the right place so we can get cracking on ASP.NET v.Next, getting the notes together for the last meeting (before the next one happens!) as well as getting the Hands-On-Labs ready for &lt;a href="http://www.microsoft.com/events/teched2008/default.mspx"&gt;this thing&lt;/a&gt;...All of which are pretty  much due right now...oh and I just got out of a multi-month relationship with my now ex-girlfriend...so let's say my time is now exactly my own right now. (Ideally I'd be sitting in a little boat in the Caribbean for a couple of weeks but alas...). Anyway in the heart of this perfect storm I managed to do a bit of fiddling with code...Essentially I'm putting a method together to help us make quicker, less onerous Codeplex releases (we want to get as much stuff there as often as possible). I've been writing (and I've written about it before) a little directory comparer tool which I'm about to expand into adding changed items into TFS (for Codeplex pushes)...for various reasons the current way TFS makes us do this is a bit problematic for us...which meant we were using a python based tool which was 1. a bit flaky (poor errors) and 2. unmaintainable since of all the languages used in my team, Python ain't one...&lt;/p&gt;  &lt;p&gt;Well, here's some code for the most recent incarnation (solution for follow)...it's getting a few add-ons like the ability to ignore certain directories / file extensions, multi-part configuration system and just a few general performance fixes. &lt;/p&gt;  &lt;p&gt;Oh, and next week I plan to take a deep dive into the ASP.NET Page framework, giving an overly detailed guided tour of how it does it's stuff... &lt;/p&gt;  &lt;div style="font-size: 8pt; background: white; color: black; font-family: verdana"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Collections;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Collections.Specialized;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.Text;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; System.IO;&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;namespace&lt;/span&gt; MergeDirs&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;    &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Program&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;        #region&lt;/span&gt; Sample Config&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: green"&gt;/* Sample code for default config creation        &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;        * {           ConfigurationGroup cg = new ConfigurationGroup();&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;            cg.ConfigurationItems.Add( new Config() { SourceDirectory = "source1", DestinationDirectory = "dest1", ClearDestination = true, ExtensionsToExclude = new List&amp;lt;string&amp;gt;(new string[] { "vssscc", "dll", "pdb", "vspscc" }), DirectoriesToExclude = new List&amp;lt;string&amp;gt;(new string[] { "bin" }) });&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;            cg.ConfigurationItems.Add(new Config() { SourceDirectory = "source2", DestinationDirectory = "dest2", ClearDestination = true, ExtensionsToExclude = new List&amp;lt;string&amp;gt;(new string[] { "vssscc", "dll", "pdb", "vspscc" }), DirectoriesToExclude = new List&amp;lt;string&amp;gt;(new string[] { "bin" }) });&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;            cg.Serialize(@"C:\TestConfig\ConfigGroup.xml");&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;            return;*/&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;        #endregion&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ConfigurationGroup&lt;/span&gt; Cfg { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; ConfigFile = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;Program&lt;/span&gt; pgm = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Program&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            pgm.Run(args);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Run(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            Cfg = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ConfigurationGroup&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;if&lt;/span&gt; (args.Length &amp;gt; 0)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; argument &lt;span style="color: blue"&gt;in&lt;/span&gt; args)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;string&lt;/span&gt; tokenName = argument.Substring(1, 1);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;switch&lt;/span&gt; (tokenName)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: blue"&gt;case&lt;/span&gt; (&lt;span style="color: #a31515"&gt;"f"&lt;/span&gt;):&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                            ConfigFile = args[0].Substring(3).Trim();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                            &lt;span style="color: blue"&gt;break&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            Cfg.Deserialize(ConfigFile);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;if&lt;/span&gt; (Cfg == &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"No config file at "&lt;/span&gt; + ConfigFile + &lt;span style="color: #a31515"&gt;" and no arguments...I can't guess!"&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadLine();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;return&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Config&lt;/span&gt; cfg &lt;span style="color: blue"&gt;in&lt;/span&gt; Cfg.ConfigurationItems)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (!&lt;span style="color: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(cfg.SourceDirectory) &amp;amp;&amp;amp; !&lt;span style="color: blue"&gt;string&lt;/span&gt;.IsNullOrEmpty(cfg.DestinationDirectory))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.Exists(cfg.SourceDirectory))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: blue"&gt;if&lt;/span&gt; (!&lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.Exists(cfg.DestinationDirectory))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                            &lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.CreateDirectory(cfg.DestinationDirectory);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: blue"&gt;if&lt;/span&gt; (!&lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.Exists(cfg.DestinationDirectory))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                            &lt;span style="color: blue"&gt;throw&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IOException&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Failed to create directory:"&lt;/span&gt; + cfg.DestinationDirectory);&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        CompareDirs(cfg.SourceDirectory, cfg.DestinationDirectory, cfg.ClearDestination, cfg.ExtensionsToExclude, cfg.DirectoriesToExclude, cfg.ExtensionsToLeave);&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Both source and destination directories must already exist!!"&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"You must specify both source and destination directories!"&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Finished!"&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;#if&lt;/span&gt; DEBUG&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadLine();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;#endif&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;bool&lt;/span&gt; CompareDirs(&lt;span style="color: blue"&gt;string&lt;/span&gt; sourceDir, &lt;span style="color: blue"&gt;string&lt;/span&gt; destDir, &lt;span style="color: blue"&gt;bool&lt;/span&gt; clearRight, &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; extensionsToExclude, &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; directoriesToExclude, &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; extensionsToLeave)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; srcFileNames = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(GetFSItems(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(sourceDir).GetFiles()));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; dstFileNames = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(GetFSItems(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(destDir).GetFiles()));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; fileName &lt;span style="color: blue"&gt;in&lt;/span&gt; srcFileNames)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: green"&gt;//Console.WriteLine(string.Format("Comparing:{0} and {1}", Path.Combine(sourceDir, fileName), Path.Combine(destDir, fileName)));&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;bool&lt;/span&gt; excludeFile = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; excludeExt &lt;span style="color: blue"&gt;in&lt;/span&gt; extensionsToExclude)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;if&lt;/span&gt; (fileName.EndsWith(&lt;span style="color: #a31515"&gt;"."&lt;/span&gt; + excludeExt))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        excludeFile = &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: blue"&gt;break&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (excludeFile)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;continue&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (!dstFileNames.Contains(fileName))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.Copy(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(sourceDir, fileName), &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, fileName));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Adding:"&lt;/span&gt; + &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, fileName));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt; srcInf = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;FileInfo&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(sourceDir, fileName)).LastWriteTime;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt; dstInf = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;FileInfo&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, fileName)).LastWriteTime;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;if&lt;/span&gt; (dstInf != srcInf)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.Copy(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(sourceDir, fileName), &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, fileName), &lt;span style="color: blue"&gt;true&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Overwriting:"&lt;/span&gt; + &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, fileName));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; fileName &lt;span style="color: blue"&gt;in&lt;/span&gt; dstFileNames)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;string&lt;/span&gt; extension = fileName.Substring(fileName.LastIndexOf(&lt;span style="color: #a31515"&gt;'.'&lt;/span&gt;) + 1);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (!srcFileNames.Contains(fileName) || extensionsToExclude.Contains(extension))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;if&lt;/span&gt; (extensionsToLeave.Contains(extension))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Leaving:"&lt;/span&gt; + fileName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: blue"&gt;continue&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.Delete(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, fileName));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                        &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Deleteing:"&lt;/span&gt; + fileName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; sourceNames = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(GetFSItems(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(sourceDir).GetDirectories()));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; destNames = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(GetFSItems(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(destDir).GetDirectories()));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; dirName &lt;span style="color: blue"&gt;in&lt;/span&gt; sourceNames)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (directoriesToExclude.Contains(dirName))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Skipping: "&lt;/span&gt; + dirName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;continue&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: green"&gt;//Console.WriteLine(string.Format("Comparing:{0} and {1}", Path.Combine(sourceDir, dirName), Path.Combine(destDir, dirName)));&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (!destNames.Contains(dirName))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: blue"&gt;string&lt;/span&gt; newDestDir = &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, dirName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.CreateDirectory(newDestDir);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Adding:"&lt;/span&gt; + &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, dirName));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    CompareDirs(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(sourceDir, dirName), newDestDir, clearRight, extensionsToExclude, directoriesToExclude, extensionsToLeave);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    CompareDirs(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(sourceDir, dirName), &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, dirName), clearRight, extensionsToExclude, directoriesToExclude, extensionsToLeave);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; dirName &lt;span style="color: blue"&gt;in&lt;/span&gt; destNames)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;if&lt;/span&gt; (!sourceNames.Contains(dirName) || directoriesToExclude.Contains(dirName))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.Delete(&lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, dirName), &lt;span style="color: blue"&gt;true&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Deleteing:"&lt;/span&gt; + &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.Combine(destDir, dirName));&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; GetFSItems(&lt;span style="color: #2b91af"&gt;FileSystemInfo&lt;/span&gt;[] dirInfos)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;FileSystemInfo&lt;/span&gt; dinf &lt;span style="color: blue"&gt;in&lt;/span&gt; dirInfos)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;                &lt;span style="color: blue"&gt;yield&lt;/span&gt; &lt;span style="color: blue"&gt;return&lt;/span&gt; dinf.Name;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;            }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;        }&lt;/p&gt;    &lt;p style="margin: 0px"&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;    }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;&lt;img src="http://mostlylucid.net/aggbug/1265.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/04/15/why-do-single-chances-make-me-nervous.life-should-come-with.aspx</guid>
            <pubDate>Wed, 16 Apr 2008 05:01:34 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/04/15/why-do-single-chances-make-me-nervous.life-should-come-with.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1265.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Obsessive Coding, optimal string Reverse...</title>
            <link>http://mostlylucid.net/archive/2008/02/04/obsessive-coding-optimal-string-reverse.aspx</link>
            <description>I love this type of thing, a whole post on &lt;a href="http://weblogs.asp.net/justin_rogers/archive/2004/06/10/153175.aspx"&gt;optimal string reverse algorithms&lt;/a&gt;. I always love this sort of thing, learning huge amounts of detail about fundamental operations (sort of, umm when do you ever reverse strings?). Actually looking at &lt;a href="http://weblogs.asp.net/justin_rogers/"&gt;Justin Rogers' blog&lt;/a&gt; he has &lt;a href="http://weblogs.asp.net/justin_rogers/archive/tags/Performance/default.aspx"&gt;lots of great performance posts&lt;/a&gt;...&lt;img src="http://mostlylucid.net/aggbug/1239.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/02/04/obsessive-coding-optimal-string-reverse.aspx</guid>
            <pubDate>Mon, 04 Feb 2008 17:00:41 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/02/04/obsessive-coding-optimal-string-reverse.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1239.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Why do so many people mess up Singletons?</title>
            <link>http://mostlylucid.net/archive/2008/01/27/why-do-so-many-people-mess-up-singletons.aspx</link>
            <description>&lt;p&gt;I've written about this a few times now (use the search thingy to find where) but I'm still surprised how many people mess up the Singleton pattern.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;For instance take:&lt;/p&gt;  &lt;p&gt;if (blogSettingsSingleton == null)   &lt;br /&gt;                {    &lt;br /&gt;                    blogSettingsSingleton = new BlogSettings();    &lt;br /&gt;                }    &lt;br /&gt;                return blogSettingsSingleton;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Looks ok, right? But this is a classic poor pattern when dealing with multi-threaded apps. Why? Look at the initial 'if' statement, and think what happens if multiple treads hit this at the same time...one thread could be in the process of creating this object whilst the others are evaluating the condition...&lt;/p&gt;  &lt;p&gt;If you're using &lt;a href="http://en.wikipedia.org/wiki/Singleton_pattern"&gt;Singletons&lt;/a&gt; PLEASE read &lt;a href="http://www.yoda.arachsys.com/csharp/singleton.html"&gt;this article&lt;/a&gt;. The singleton pattern article from Wikipedia has the following excellent implementation of a singleton:&lt;/p&gt;  &lt;pre class="code"&gt;/// &amp;lt;summary&amp;gt;
/// Class implements singleton pattern.
/// &amp;lt;/summary&amp;gt;
public class Singleton
{
        // Private constructor to avoid other instantiation
        // This must be present otherwise the compiler provide 
        // a default public constructor
        private Singleton()
        {
        }
 
        /// &amp;lt;summary&amp;gt;
        /// Return an instance of &amp;lt;see cref="Singleton"/&amp;gt;
        /// &amp;lt;/summary&amp;gt;
        public static Singleton Instance
        {
            get
            {
                /// An instance of Singleton wont be created until the very first 
                /// call to the sealed class. This a CLR optimization that ensure that
                /// we have properly lazy-loading singleton. 
                return SingletonCreator.CreatorInstance;
            }
        }
 
        /// &amp;lt;summary&amp;gt;
        /// Sealed class to avoid any heritage from this helper class
        /// &amp;lt;/summary&amp;gt;
        private sealed class SingletonCreator
        {
          // Retrieve a single instance of a Singleton
          private static readonly Singleton _instance = new Singleton();
 
          /// &amp;lt;summary&amp;gt;
          /// Return an instance of the class &amp;lt;see cref="Singleton"/&amp;gt;
          /// &amp;lt;/summary&amp;gt;
          public static Singleton CreatorInstance
          {
            get { return _instance; }
          }
        }
}
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/pre&gt;

&lt;p&gt;This is a lazy-initializing, thread safe singleton...does sacrifice *some* performance (see the &lt;a href="http://www.yoda.arachsys.com/csharp/singleton.html"&gt;earlier article&lt;/a&gt; for details of this) but it is FAR safer than the original I showed...&lt;/p&gt;

&lt;p&gt;Oh, and one last thing...are you REALLY sure you need a Singleton? One horrible pattern I've seen is code is using Singletons to access database connections...this is VERY RARELY required and sacrifices a lot of the benefits which modern databases offer for concurrent access.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;UPDATE:&lt;/font&gt; Umm...realized that I don't explain what a 'Singleton' is...essentially it's a pattern which limits the access of an object to a single caller at a time. Common uses for Singletons could be accessing files on a file-system where you really want to make sure that only one thread has access at one time. Oh, and to make things even more complicated you'd more commonly want to use a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.threading.readerwriterlock(VS.71).aspx"&gt;ReaderWriterLock&lt;/a&gt; in this scenario to allow many readers or a single writer...only &lt;a href="http://msdn.microsoft.com/msdnmag/issues/06/06/ConcurrentAffairs/"&gt;of course you wouldn't&lt;/a&gt;...told you it was complicated! Oh, and to further complicate matters in VS2008 and above you'd probably want &lt;a href="http://www.bluebytesoftware.com/blog/PermaLink,guid,c4ea3d6d-190a-48f8-a677-44a438d8386b.aspx"&gt;ReaderWriterLockSlim&lt;/a&gt;!&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1238.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2008/01/27/why-do-so-many-people-mess-up-singletons.aspx</guid>
            <pubDate>Mon, 28 Jan 2008 00:47:55 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2008/01/27/why-do-so-many-people-mess-up-singletons.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1238.aspx</wfw:commentRss>
        </item>
        <item>
            <title>C# null Coalescing operator</title>
            <link>http://mostlylucid.net/archive/2007/11/03/c-null-coalescing-operator.aspx</link>
            <description>&lt;p&gt;Just because I always forget this...the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/09/20/the-new-c-null-coalescing-operator-and-using-it-with-linq.aspx"&gt;C# null Coalescing operator&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;Sample below shamelessly stolen &lt;a href="http://www.sturmnet.org/blog/archives/2005/06/15/doublequestionmark/"&gt;from here&lt;/a&gt;...&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;MyClass anObject;&lt;br /&gt;
...&lt;br /&gt;
// Variant 1: Using a full if/else clause&lt;br /&gt;
MyClass anotherObject;&lt;br /&gt;
if (anObject != null)&lt;br /&gt;
  anotherObject = anObject;&lt;br /&gt;
else&lt;br /&gt;
  anotherObject = new MyClass();&lt;br /&gt;
 &lt;br /&gt;
// Variant 2: Using the ?/: conditional operator&lt;br /&gt;
MyClass anotherObject = anObject != null ? anObject : new MyClass();&lt;br /&gt;
 &lt;br /&gt;
// Variant 3: Using the ?? operator&lt;br /&gt;
MyClass anotherObject = anObject ?? new MyClass();&lt;/font&gt;&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1233.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2007/11/03/c-null-coalescing-operator.aspx</guid>
            <pubDate>Sun, 04 Nov 2007 01:07:42 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2007/11/03/c-null-coalescing-operator.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1233.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Crazy busy at work, back soon!</title>
            <link>http://mostlylucid.net/archive/2007/10/17/crazy-busy-at-work-back-soon.aspx</link>
            <description>&lt;p&gt;Things have been insane at work over the past few days...back to this soon! Plan to get a nice 'Amazon book suggestion' tool on the site; going to let readers suggest books on various topics by entering an &lt;a href="http://en.wikipedia.org/wiki/ISBN"&gt;ISBN&lt;/a&gt; and then provide the country appropriate URL to buy that book. Still fiddling with the new Amazon web services bits but it's nearly there...&lt;/p&gt;  &lt;p&gt;See you at the weekend (probably!)&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1226.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2007/10/17/crazy-busy-at-work-back-soon.aspx</guid>
            <pubDate>Wed, 17 Oct 2007 20:44:05 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2007/10/17/crazy-busy-at-work-back-soon.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1226.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Update to my favorite Live.com service</title>
            <link>http://mostlylucid.net/archive/2007/10/11/update-to-my-favorite-live.com-service.aspx</link>
            <description>&lt;p&gt;I have to say, &lt;a href="http://skydrive.live.com" target="_blank"&gt;Skydrive&lt;/a&gt; is the best thing &lt;a href="http://www.live.com" target="_blank"&gt;Live&lt;/a&gt; has done so far in my opinion...very easy way to share files. I use it a lot to share stuff with my family back in the UK, my parents aren't very computer savvy but the Skydrive interface is really simple to use (they're used to folders and such...).&lt;br /&gt;I'm going to be very cheeky and just paste a bit of the mail which one of the PMs (Program Managers) from that team sent round today:&lt;/p&gt; &lt;p&gt;"We’re excited to announce that at 3pm, today, we’re updating Windows Live SkyDrive (&lt;a href="http://skydrive.live.com"&gt;http://skydrive.live.com&lt;/a&gt;) with some new features, and with more storage!  Here are the highlights of these updates. &lt;/p&gt;&lt;p&gt;· &lt;b&gt;1 GB of storage&lt;/b&gt; – Everyone now gets 1 GB of space. &lt;/p&gt;&lt;p&gt;· &lt;b&gt;RSS feeds&lt;/b&gt; – You can subscribe to RSS feeds on public folders.  You will receive a notification anytime someone changes the folder. &lt;/p&gt;&lt;p&gt;· &lt;b&gt;Add a contact from the SkyDrive website&lt;/b&gt; – You no longer have to go to Hotmail or Messenger to add contacts to share with.  You can now add contacts on the SkyDrive website. &lt;/p&gt;&lt;p&gt;· &lt;b&gt;See who uploaded a file&lt;/b&gt; – On the page that tells you all the details about a file, you can now see who uploaded the file. &lt;/p&gt;&lt;p&gt;· &lt;b&gt;Share with non Live IDs&lt;/b&gt;—In the past, only Live ID contacts would appear in your contact picker.  Now, you can share with any e-mail address.  The owner of the non Live ID e-mail address will receive an e-mail with instructions on how to access the shared folder. &lt;/p&gt;&lt;p&gt;· &lt;b&gt;A bunch of more little features and fixes&lt;/b&gt;. &lt;/p&gt;&lt;p&gt;Our team blog will be updated at 3pm, and it will highlight some of our new features: &lt;a href="http://skydriveteam.spaces.live.com/default.aspx"&gt;http://skydriveteam.spaces.live.com/default.aspx&lt;/a&gt;." &lt;/p&gt;&lt;p&gt;So, very nice updates...and you can't argue with a full gig of free online storage for just about anything you want! Oh, and if you use &lt;a href="http://get.live.com/betas/writer_betas" target="_blank"&gt;Live Writer&lt;/a&gt; there's a &lt;a href="http://www.codeplex.com/SkyDriveEmbedPlugin" target="_blank"&gt;neat little plugin&lt;/a&gt; for embedding Skydrive stuff. &lt;br /&gt;Just for fun here's the code for the little tracking module I wrote a couple of weeks ago (messy code I should add!):  &lt;/p&gt;&lt;p&gt;&lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 26px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-d670c15744f77c28.skydrive.live.com/embedrow.aspx/Public/ML.zip" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Of course the other cool thing is that I don't pay for the bandwidth that download takes up!&lt;br /&gt;P.S., fo the record here's the &lt;a href="http://skydriveteam.spaces.live.com/blog/cns!977F793E846B3C96!879.entry" target="_blank"&gt;SkyDrive team post&lt;/a&gt; on the update...&lt;/p&gt;&lt;img src="http://mostlylucid.net/aggbug/1223.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Galloway</dc:creator>
            <guid>http://mostlylucid.net/archive/2007/10/11/update-to-my-favorite-live.com-service.aspx</guid>
            <pubDate>Thu, 11 Oct 2007 23:56:49 GMT</pubDate>
            <comments>http://mostlylucid.net/archive/2007/10/11/update-to-my-favorite-live.com-service.aspx#feedback</comments>
            <wfw:commentRss>http://mostlylucid.net/comments/commentRss/1223.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>