<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
	<channel>
		<title>Douglas Stockwell's Weblog</title>
		<link>http://11011.net/</link>
		<image>
			<url>http://11011.net/email.png</url>
		</image>
		<description />
		<dc:language>en-au</dc:language>
		<dc:date>2007-11-26T13:15:45+10:00</dc:date>
		<dc:creator>Douglas Stockwell</dc:creator>
		<item>
			<title>F# in Visual Studio 2008 for free!</title>
			<link>http://11011.net/archives/000721.html</link>
			<description>&lt;p&gt;Although there will presumably be a Visual F# Express at some point in the future, at the moment the &lt;a href="http://research.microsoft.com/fsharp/release.aspx"&gt;F# Visual Studio addin&lt;/a&gt; requires a full version of Visual Studio since the other express versions do not allow addins.&lt;/p&gt;  &lt;p&gt;It just so happens that with the release of Visual Studio 2008 we can now download a &amp;quot;full&amp;quot; version for free, it's called &lt;em&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=40646580-97FA-4698-B65F-620D4B4B1ED7"&gt;Visual Studio 2008 Shell&lt;/a&gt;&lt;/em&gt; and is designed specifically for language addins. The only difference is that it comes naked, without support for C#, VB.NET or C++.&lt;/p&gt;  &lt;p&gt;Just install &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=40646580-97FA-4698-B65F-620D4B4B1ED7"&gt;Visual Studio 2008 Shell (Integrated mode)&lt;/a&gt; then &lt;a href="http://research.microsoft.com/fsharp/release.aspx"&gt;F#&lt;/a&gt;. If the F# addin does not function at first, launch &amp;quot;devenv.exe /setup&amp;quot;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/190508384" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">721@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-11-26T13:15:45+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000721.xml</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Update: Paste From Visual Studio for Windows Live Writer</title>
			<link>http://11011.net/archives/000720.html</link>
			<description>&lt;p&gt;I just released a new version of my &lt;a href="http://get.live.com/writer/overview"&gt;Windows Live Writer&lt;/a&gt; plugin &lt;em&gt;&lt;a href="http://gallery.live.com/LiveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9"&gt;Paste From Visual Studio&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The new version sports:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;More compact HTML output &lt;/li&gt;    &lt;li&gt;Support for non-ASCII characters &lt;/li&gt;    &lt;li&gt;Automatic stripping of leading whitespace &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Sample output:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public string &lt;/span&gt;CssColor(&lt;span style="color: blue"&gt;int &lt;/span&gt;i)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(i &amp;gt;= 0 &amp;amp;&amp;amp; i &amp;lt; colors.Count)
    {
        &lt;span style="color: blue"&gt;string &lt;/span&gt;name = &lt;span style="color: blue"&gt;null&lt;/span&gt;;
        &lt;span style="color: maroon"&gt;Color &lt;/span&gt;color = colors[i];

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(namedColors.TryGetValue(color.ToArgb(), &lt;span style="color: blue"&gt;out &lt;/span&gt;name) &amp;amp;&amp;amp; name.Length &amp;lt;= 7)
            &lt;span style="color: blue"&gt;return &lt;/span&gt;name.ToLower();
        &lt;span style="color: blue"&gt;else
            return string&lt;/span&gt;.Format(&lt;span style="background: yellow; color: #a31515"&gt;&amp;quot;#{1:x2}{2:x2}{3:x2}&amp;quot;&lt;/span&gt;, i, color.R, color.G, color.B);
    }
    &lt;span style="color: blue"&gt;else
        return &lt;/span&gt;&lt;span style="background: yellow; color: #a31515"&gt;&amp;quot;black&amp;quot;&lt;/span&gt;;
}&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Corresponding HTML:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;pre &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;code&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;public string &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;CssColor(&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;int &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;i)
{
    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;if &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;(i &lt;span style="color: red"&gt;&amp;amp;gt;&lt;/span&gt;= 0 &lt;span style="color: red"&gt;&amp;amp;amp;&amp;amp;amp; &lt;/span&gt;i &lt;span style="color: red"&gt;&amp;amp;lt; &lt;/span&gt;colors.Count)
    {
        &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;string &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;name = &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;null&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;;
        &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:maroon&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;Color &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;color = colors[i];

        &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;if &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;(namedColors.TryGetValue(color.ToArgb(), &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;out &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;name) &lt;span style="color: red"&gt;&amp;amp;amp;&amp;amp;amp; &lt;/span&gt;name.Length &lt;span style="color: red"&gt;&amp;amp;lt;&lt;/span&gt;= 7)
            &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color: blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;return &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;name.ToLower();
        &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;else
            return string&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;.Format(&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;background:yellow;color:#a31515&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&amp;quot;#{1:x2}{2:x2}{3:x2}&amp;quot;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;, i, color.R, color.G, color.B);
    }
    &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;color:blue&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;else
        return &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;background:yellow;color:#a31515&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&amp;quot;black&amp;quot;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;;
}&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;pre&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/189649743" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">720@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-11-24T14:00:08+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000720.xml</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>The Imagine Cup pays off: RikPVR</title>
			<link>http://11011.net/archives/000719.html</link>
			<description>&lt;p&gt;After the 2004 Imagine Cup [&lt;a href="http://www.mshk.com/hk/msdn/ic2005/IC_04_program_final.pdf"&gt;pdf&lt;/a&gt;], Richard and I walked away with memories and a new wardrobe of Microsoft T-Shirts. In 2008 &lt;a href="http://blogs.msdn.com/msozacademic/archive/2007/11/07/news-just-in-aussie-imagine-cup-entrants-can-win-a-job.aspx"&gt;Readify is offering paid work placements&lt;/a&gt; to the top finalists. Times have changed, but the core of the competition remains the same - building &lt;em&gt;&lt;/em&gt;&lt;em&gt;&lt;a href="http://www.rikpvr.com/?11011"&gt;amazing software&lt;/a&gt;&lt;/em&gt;. &lt;/p&gt;  &lt;p&gt;T-Shirts aside we also built a lot of IP, which Richard and his passion for recording &lt;em&gt;copious amounts of Television&lt;/em&gt; has slowly been able to turn into a viable commercial application. &lt;/p&gt;  &lt;p&gt;On the 20th of October, Richard launched &lt;a href="http://www.rikpvr.com/?11011"&gt;RikPVR&lt;/a&gt;! &lt;/p&gt;  &lt;p&gt;&lt;/p&gt; &lt;center&gt;&lt;a href="http://www.rikpvr.com/?11011"&gt;&lt;img class="thumbnail" alt="There are plenty of free to air channels here in Tokyo" src="http://11011.net/files/rikpvr-small.png" /&gt;&lt;/a&gt;&amp;#160;&lt;/center&gt;  &lt;p&gt;This is the evolution, or perhaps revolution of what was once the &amp;quot;TV Prognosticator&amp;quot;: n-thousand lines of code that flew us both half way around the world. Rewritten, tuned and tested, but the premise remains the same: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt; &lt;center&gt;&lt;em&gt;Putting you in control of your TV viewing by making recording simple.&lt;/em&gt;&lt;/center&gt;&lt;center&gt;&amp;#160;&lt;/center&gt;  &lt;p&gt;All you need is a Windows PC (XP or better) and a Digital TV Tuner (of the DVB-T kind) and you will be able to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Get setup in just a few minutes with the setup wizard. &lt;/li&gt;    &lt;li&gt;Pull in guide data from any XMLTV source. &lt;/li&gt;    &lt;li&gt;Record n-channels with n-tuners in n-clicks. &lt;/li&gt;    &lt;li&gt;Check on recordings, stop early or add time if they're running late. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Richard is continuing to innovate, over on the &lt;a href="http://www.rikpvr.com/blog.aspx"&gt;RikPVR blog&lt;/a&gt; he mentions that in the future it should be possible to &lt;a href="http://www.rikpvr.com/post/Recording-multiple-channels-on-single-TV-card.aspx"&gt;record multiple co-channels on a single tuner&lt;/a&gt;, there's also a rumor that viewing live TV and recordings in progress is not far off. &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/184492663" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">719@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-11-14T15:20:26+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000719.xml</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Minimal CAPTCHA unleashes unfounded levels of genuine comments on 11011.net</title>
			<link>http://11011.net/archives/000718.html</link>
			<description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Joseph was recently &lt;a href="http://jcooney.net/archive/2007/11/13/55308.aspx"&gt;disgraced&lt;/a&gt; after his &lt;em&gt;learnwpf&lt;/em&gt; CAPTCHA was h4cked by &lt;em&gt;websecurity.com.ua. &lt;/em&gt;That got me thinking about my own &lt;em&gt;highly secure&lt;/em&gt; implementation.&lt;/p&gt;  &lt;p&gt;About 18 months ago the spam on my blog reached the point where I had to do &lt;em&gt;something&lt;/em&gt; about it. I weighed my time and spent about 30s implementing the following.&lt;/p&gt;  &lt;p&gt;&lt;img alt="This is not spam (check to post): []" src="http://11011.net/files/spamcheck.png" /&gt; &lt;/p&gt;  &lt;p&gt;And... I haven't had a single spam since. With relatively low traffic and a unique CAPTCHA it's easy enough to slide under the spammers radar. However by requiring even the most minimal CAPTCHA spammers have damaged the usability of my site. The extra effort required to click that extra checkbox is &lt;em&gt;obviously&lt;/em&gt; the main deterrent for genuine commenters.&lt;/p&gt;  &lt;p&gt;Until today! Announcing the &amp;quot;Magical Disappearing Minimal CAPTCHA&amp;quot; (MDMCAPTCHA).&lt;/p&gt;  &lt;p&gt;I've also spiced things up by adding live preview and validation - &lt;em&gt;fewer clicks&lt;/em&gt;!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/184440599" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">718@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-11-14T12:56:08+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000718.xml</wfw:commentRss>
			<slash:comments>7</slash:comments>
		</item>
		<item>
			<title>Observable LINQ</title>
			<link>http://11011.net/archives/000717.html</link>
			<description>&lt;p&gt;So I have been neglecting my blog, &lt;a href="http://11011.net/archives/000704.html"&gt;Observable LINQ Part 3&lt;/a&gt;&amp;nbsp;never made it and&amp;nbsp;it now&amp;nbsp;looks like Paul Stovell will beat me to release with his &lt;a href="http://www.paulstovell.net/blog/index.php/introducing-synclinq/"&gt;SyncLINQ&lt;/a&gt;&amp;nbsp;project. Head over to his blog for a nice &lt;a href="http://www.paulstovell.net/IntroducingSyncLINQ.wmv"&gt;screencast&lt;/a&gt; on the technology. This is very similar to my implementation which is already alive in &lt;a href="http://11011.net/software/rikreader"&gt;RikReader&lt;/a&gt;. But not to worry, Observable LINQ may one day see the light of day, I still have a few tricks up my sleeve ;)&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/170376618" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">717@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-10-16T09:33:06+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000717.xml</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Thanks for using Microsoft Connect!</title>
			<link>http://11011.net/archives/000714.html</link>
			<description>&lt;blockquote&gt; &lt;p&gt;&lt;em&gt;Product/Technology - Visual Studio and .NET Framework&lt;br&gt;Feedback ID - 284008&lt;br&gt;Feedback Title - Valuetypes are boxed in Array.BinarySearch(T[], T), Array.Sort(T[]), Comparer.Default and EqualityComparer.Default&lt;br&gt;The following fields or values changed:&lt;br&gt;Field Resolution changed from [Not Set] to [&lt;strong&gt;Not Reproducible&lt;/strong&gt;]&lt;br&gt;Field Status changed from [Active] to [&lt;strong&gt;Resolved&lt;/strong&gt;]&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Are the testers incompetent or is it all in my head?  &lt;p&gt;If anyone with an &lt;strong&gt;x64&lt;/strong&gt; machine would like to help confirm my sanity, could you compile and run the following program?&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Test
&lt;/span&gt;{
    &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Main()
    {
        &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;[] ints = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;[] { 1 };

        &lt;span style="color: rgb(0,0,255)"&gt;while&lt;/span&gt; (&lt;span style="color: rgb(0,0,255)"&gt;true&lt;/span&gt;)
        {
            System.&lt;span style="color: rgb(43,145,175)"&gt;Array&lt;/span&gt;.BinarySearch&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;(ints, 1);
        }
    }
}&lt;/pre&gt;
&lt;p&gt;Fire up the "Performance Monitor" and add counters for (.NET CLR Memory): 
&lt;ul&gt;
&lt;li&gt;Gen 0 Collections - a lot 
&lt;li&gt;% Time in GC - I'm seeing about 0.7% 
&lt;li&gt;Allocated Bytes/sec - about 400mb/s&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;I'm running Windows Vista Ultimate x64 on an E6600&amp;nbsp;with the x64 CLR 2.0.50727.&lt;/p&gt;
&lt;p&gt;My&amp;nbsp;theory for why it doesn't reproduce on x86? "secret magical JIT optimisation".&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/146335861" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">714@http://11011.net/</guid>
			<dc:subject>Programming</dc:subject>
			<dc:date>2007-08-21T12:11:04+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000714.xml</wfw:commentRss>
			<slash:comments>1</slash:comments>
		</item>
		<item>
			<title>RikReader 1.6</title>
			<link>http://11011.net/archives/000713.html</link>
			<description>&lt;p&gt;1.5 was a silent release mostly dealing with performance improvements.&lt;/p&gt; &lt;p&gt;1.6 adds annotations: text/ink tagging, and highlighting. Text annotations are indexed and can be searched using the "tag:" prefix. Handwriting recognition will be added for Ink annotations in a future release. Annotations can be added using some new icons at the bottom left of the two-pane reader. Text annotations can also be added by CTRL-T.&lt;/p&gt; &lt;p&gt;I uncovered a indexing&amp;nbsp;problem where some items were not being removed from the index when deleted. 1.6 addresses this by rebuilding the entire index, so please be aware that this process can take several minutes on the first run.&lt;/p&gt; &lt;p&gt;Head over to the &lt;a href="http://11011.net/software/rikreader"&gt;main RikReader page&lt;/a&gt; for download links.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/134786177" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">713@http://11011.net/</guid>
			<dc:subject>RikReader</dc:subject>
			<dc:date>2007-07-18T13:08:52+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000713.xml</wfw:commentRss>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>JScriptConverter fixed</title>
			<link>http://11011.net/archives/000712.html</link>
			<description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;I've been chasing a bug in RikReader ever since people started sending error reports back to me. This particular one is curious because it's dependent on the Operating System's UI Language, so I get the reports back in an assortment of languages. &lt;/p&gt; &lt;p&gt;Todo: I could probably serialise these in English initially, but that's not the problem at the moment.&lt;/p&gt; &lt;p&gt;FileNotFoundException:  &lt;ul&gt;
&lt;li&gt;&amp;#1053;&amp;#1077;&amp;#1074;&amp;#1086;&amp;#1079;&amp;#1084;&amp;#1086;&amp;#1078;&amp;#1085;&amp;#1086; &amp;#1079;&amp;#1072;&amp;#1075;&amp;#1088;&amp;#1091;&amp;#1079;&amp;#1080;&amp;#1090;&amp;#1100; &amp;#1092;&amp;#1072;&amp;#1081;&amp;#1083; &amp;#1080;&amp;#1083;&amp;#1080; &amp;#1089;&amp;#1073;&amp;#1086;&amp;#1088;&amp;#1082;&amp;#1091; "...y88nnzzx.dll" &amp;#1080;&amp;#1083;&amp;#1080; &amp;#1086;&amp;#1076;&amp;#1080;&amp;#1085; &amp;#1080;&amp;#1079; &amp;#1079;&amp;#1072;&amp;#1074;&amp;#1080;&amp;#1089;&amp;#1080;&amp;#1084;&amp;#1099;&amp;#1093; &amp;#1086;&amp;#1090; &amp;#1085;&amp;#1080;&amp;#1093; &amp;#1082;&amp;#1086;&amp;#1084;&amp;#1087;&amp;#1086;&amp;#1085;&amp;#1077;&amp;#1085;&amp;#1090;&amp;#1086;&amp;#1074;. &amp;#1053;&amp;#1077; &amp;#1091;&amp;#1076;&amp;#1072;&amp;#1077;&amp;#1090;&amp;#1089;&amp;#1103; &amp;#1085;&amp;#1072;&amp;#1081;&amp;#1090;&amp;#1080; &amp;#1091;&amp;#1082;&amp;#1072;&amp;#1079;&amp;#1072;&amp;#1085;&amp;#1085;&amp;#1099;&amp;#1081; &amp;#1092;&amp;#1072;&amp;#1081;&amp;#1083;. 
&lt;li&gt;Não foi possível carregar arquivo ou assembly '...7uwqjtre.dll' ou uma de suas dependências. O sistema não pode encontrar o arquivo especificado. 
&lt;li&gt;Impossible de charger le fichier ou l'assembly '...qxpulisn.dll' ou une de ses dépendances. Le fichier spécifié est introuvable. 
&lt;li&gt;Det går inte att läsa in filen eller sammansättningen ...pyq_nlzi.dll eller ett av dess beroenden. Det går inte att hitta filen. 
&lt;li&gt;&amp;#28961;&amp;#27861;&amp;#36617;&amp;#20837;&amp;#27284;&amp;#26696;&amp;#25110;&amp;#32068;&amp;#20214; '...5gxdnvh4.dll' &amp;#25110;&amp;#20854;&amp;#30456;&amp;#20381;&amp;#24615;&amp;#30340;&amp;#20854;&amp;#20013;&amp;#20043;&amp;#19968;&amp;#12290; &amp;#31995;&amp;#32113;&amp;#25214;&amp;#19981;&amp;#21040;&amp;#25351;&amp;#23450;&amp;#30340;&amp;#27284;&amp;#26696;&amp;#12290; 
&lt;li&gt;Die Datei oder Assembly ...6dokpecz.dll oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
&lt;li&gt;&amp;#12501;&amp;#12449;&amp;#12452;&amp;#12523;&amp;#12414;&amp;#12383;&amp;#12399;&amp;#12450;&amp;#12475;&amp;#12531;&amp;#12502;&amp;#12522; '...gnxsmxbd.dll'&amp;#12289;&amp;#12414;&amp;#12383;&amp;#12399;&amp;#12381;&amp;#12398;&amp;#20381;&amp;#23384;&amp;#38306;&amp;#20418;&amp;#12398; 1 &amp;#12388;&amp;#12364;&amp;#35501;&amp;#12415;&amp;#36796;&amp;#12417;&amp;#12414;&amp;#12379;&amp;#12435;&amp;#12391;&amp;#12375;&amp;#12383;&amp;#12290;&amp;#25351;&amp;#23450;&amp;#12373;&amp;#12428;&amp;#12383;&amp;#12501;&amp;#12449;&amp;#12452;&amp;#12523;&amp;#12364;&amp;#35211;&amp;#12388;&amp;#12363;&amp;#12426;&amp;#12414;&amp;#12379;&amp;#12435;&amp;#12290;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Which I think means "Unable to load assembly &amp;lt;file.dll&amp;gt; or one of its dependencies. The file cannot be found."&lt;/p&gt; &lt;p&gt;It was caused by this seemingly innocent code in &lt;em&gt;&lt;a href="http://11011.net/archives/000668.html"&gt;JScriptConverter&lt;/a&gt;:&lt;/em&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(43,145,175)"&gt;CompilerParameters&lt;/span&gt; cp = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;CompilerParameters&lt;/span&gt;();
cp.GenerateInMemory = &lt;span style="color: rgb(0,0,255)"&gt;true&lt;/span&gt;;

&lt;span style="color: rgb(43,145,175)"&gt;CompilerResults&lt;/span&gt; results = 
    &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; Microsoft.JScript.&lt;span style="color: rgb(43,145,175)"&gt;JScriptCodeProvider&lt;/span&gt;()
    .CompileAssemblyFromSource(cp, source);

&lt;span style="color: rgb(43,145,175)"&gt;Assembly&lt;/span&gt; result = results.CompiledAssembly;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;I have the Japanese MUI set up on another account, so I was able to find out that &lt;em&gt;CompileAssemblyFromSource&lt;/em&gt;&amp;nbsp;was setting an&amp;nbsp;error status which I didn't check. That error being the even more cryptic:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;error JS2999: Microsoft.Vsa.VsaException: ItemNameInUse (0x80133024)&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I don't know what that means, nor why it is dependent on MUI. So I gave up searching and just rewrote &lt;em&gt;JScriptConverter&lt;/em&gt; to set up the evaluation from C# instead of generating a seperate assembly.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;VsaEngine&lt;/span&gt; engine = &lt;span style="color: rgb(43,145,175)"&gt;VsaEngine&lt;/span&gt;.CreateEngine();
&lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;JSLocalField&lt;/span&gt;[] fields = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;JSLocalField&lt;/span&gt;[]
    { &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;JSLocalField&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;&lt;span style="background: rgb(255,255,0)"&gt;"values"&lt;/span&gt;&lt;/span&gt;, &lt;span style="color: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt;[]).TypeHandle, 0) };

&lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; Evaluate(&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt; code, &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt;[] values)
{
    &lt;span style="color: rgb(43,145,175)"&gt;StackFrame&lt;/span&gt;.PushStackFrameForMethod(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt;(), fields, engine);
    ((&lt;span style="color: rgb(43,145,175)"&gt;StackFrame&lt;/span&gt;)engine.ScriptObjectStackTop()).localVars[0] = values;
    &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; result = &lt;span style="color: rgb(43,145,175)"&gt;Eval&lt;/span&gt;.JScriptEvaluate(code, &lt;span style="color: rgb(163,21,21)"&gt;&lt;span style="background: rgb(255,255,0)"&gt;"unsafe"&lt;/span&gt;&lt;/span&gt;, engine);
    engine.PopScriptObject();
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; result;
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Which turned out simpler than expected. The full implementation of &lt;a href="http://11011.net/files/jscriptconverter.html"&gt;JScriptConverter is here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130334954" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">712@http://11011.net/</guid>
			<dc:subject>Windows Presentation Foundataion</dc:subject>
			<dc:date>2007-07-04T15:32:46+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000712.xml</wfw:commentRss>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>Comparer Boxing Workaround</title>
			<link>http://11011.net/archives/000711.html</link>
			<description>&lt;p&gt;Following on from my previous post, I've created some wrappers around &lt;em&gt;System.Collection.Generics.Comparer&amp;lt;T&amp;gt;.Default&lt;/em&gt; and &lt;em&gt;System.Collections.Generic.EqualityComparer&amp;lt;T&amp;gt;.Default &lt;/em&gt;which return specialised versions for dealing with &lt;em&gt;ValueTypes &lt;/em&gt;without boxing&lt;em&gt;.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;For the previous example, we can eliminate the boxing like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;[] ints = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;[] { 1 };
&lt;span style="color: rgb(43,145,175)"&gt;Array&lt;/span&gt;.BinarySearch&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;(ints, 1, Utils.Collections.&lt;span style="color: rgb(43,145,175)"&gt;Comparer&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;.Default);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Or for a &lt;em&gt;Dictionary&amp;lt;K,V&amp;gt;.&lt;/em&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;, &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;(Utils.Collections.&lt;span style="color: rgb(43,145,175)"&gt;EqualityComparer&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;.Default);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;The code is &lt;a href="http://11011.net/files/comparers.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Actually,&amp;nbsp;it seems&amp;nbsp;&lt;em&gt;Dictionary&amp;lt;K,V&amp;gt;&lt;/em&gt;&amp;nbsp;is broken too,&amp;nbsp;since all the methods which take a &lt;em&gt;Key &lt;/em&gt;(&lt;em&gt;Add, Contains, TryGetValue, Remove&lt;/em&gt;) still end up boxing by checking the key against null.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282537" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">711@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-06-24T19:24:29+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000711.xml</wfw:commentRss>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>BCL Generics Boxing Bug?</title>
			<link>http://11011.net/archives/000710.html</link>
			<description>&lt;p&gt;Here's another challenge, &lt;em&gt;"Binary search an array of int without boxing"&lt;/em&gt;, I'll even give you the wrong answer &lt;em&gt;"Use the generic Array.BinarySearch&amp;lt;T&amp;gt;(T[], T) method".&lt;/em&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;[] ints = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;[] { 1 };
&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; index = &lt;span style="color: rgb(43,145,175)"&gt;Array&lt;/span&gt;.BinarySearch&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;(ints, 1);&lt;/pre&gt;
&lt;p&gt;Try running the second line 100,000 times in the CLR Profiler and you'll see a good 2.3mb or so of heap allocations. The&amp;nbsp;cause as shown by the CLR&amp;nbsp;Profiler&amp;nbsp;lies in &lt;em&gt;GenericArraySortHelper&amp;lt;T&amp;gt;. BinarySearch(T[], Int32, Int32, T). &lt;/em&gt;The corresponding C# probably looks something like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (array[mid] == &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;)
    cmp = (value == &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;) ? 0 : -1;
&lt;span style="color: rgb(0,0,255)"&gt;else
&lt;/span&gt;    cmp = array[mid].CompareTo(value);&lt;/pre&gt;
&lt;p&gt;In IL, that comparison against null looks like this:&lt;/p&gt;&lt;pre class="code"&gt;ldarg 'value'
box !T
brfalse 'somewhere'&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;box&lt;/em&gt; instruction is something you really don't want to see&amp;nbsp;in a code path that accepts &lt;em&gt;ValueTypes&lt;/em&gt;. One way to avoid it would have been a separate &lt;em&gt;ArraySortHelper&lt;/em&gt; for dealing with value types - but for now no such class exists.&lt;/p&gt;
&lt;p&gt;The BCL authors of this specific area seem to have been unaware of the boxing, at least that's what these comments from the SSCLI/2.0 seem to indicate:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,128,0)"&gt;// This function is called when the user doesn't specify any comparer.
// Since T is constrained here, we can call IComparable&amp;lt;T&amp;gt;.CompareTo here.
// We can avoid boxing for value type and casting for reference types.&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;On further examination &lt;em&gt;Array.Sort&amp;lt;T&amp;gt;&lt;/em&gt;,&amp;nbsp;&lt;em&gt;Comparer&amp;lt;T&amp;gt;.Default&lt;/em&gt; and &lt;em&gt;EqualityComparer&amp;lt;T&amp;gt;.Default&lt;/em&gt; seem to be equally broken for value types. This is a pretty serious issue,&amp;nbsp;even more so since&amp;nbsp;&lt;em&gt;Array.Sort/BinarySearch&lt;/em&gt; is used internally by &lt;em&gt;List&amp;lt;T&amp;gt;&lt;/em&gt;. &lt;em&gt;IEquatable&amp;lt;T&amp;gt;&lt;/em&gt; and thus a default &lt;em&gt;EqualityComparer&amp;lt;T&amp;gt;&lt;/em&gt; is used by &lt;em&gt;List&amp;lt;T&amp;gt;.Contains&lt;/em&gt; and much of &lt;em&gt;Dictionary&amp;lt;T,U&amp;gt;. &lt;/em&gt;I'm surprised &lt;em&gt;EqualityComparer&amp;lt;T&amp;gt;&lt;/em&gt;&amp;nbsp;now seems to be&amp;nbsp;boxing since I vaguely remember using &lt;em&gt;IEquatable&amp;lt;T&amp;gt;&lt;/em&gt; to solve boxing in a &lt;em&gt;Dictionary&lt;/em&gt; once before.&lt;/p&gt;
&lt;p&gt;I have filed a bug &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=284008"&gt;here on connect.microsoft.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are workarounds, but they require writing your own code, the easiest is to pass your own &lt;em&gt;IComparer&amp;lt;T&amp;gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update (11 July)&lt;/strong&gt;: Maybe we can breathe a little easier, it&amp;nbsp;looks like&amp;nbsp;the problem may only occur on the x64 CLR. I guess the x86 JIT is smart enough to skip over the box/brfalse instructions!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282538" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">710@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-06-24T17:47:26+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000710.xml</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>C# Closure Quiz</title>
			<link>http://11011.net/archives/000709.html</link>
			<description>&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Test(&lt;span style="color: rgb(0,0,255)"&gt;out&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;SomeDelegate&lt;/span&gt; d1, &lt;span style="color: rgb(0,0,255)"&gt;out&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;SomeDelegate&lt;/span&gt; d2)
{
    &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; a = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ObjectGraph&lt;/span&gt;();
    d1 = &lt;span style="color: rgb(0,0,255)"&gt;delegate&lt;/span&gt; { &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; a; };

    &lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; b = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ObjectGraph&lt;/span&gt;();
    d2 = &lt;span style="color: rgb(0,0,255)"&gt;delegate&lt;/span&gt; { &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; b; };
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This contrived method is the &lt;em&gt;potential&lt;/em&gt; root of some undesired&amp;nbsp;characteristics&amp;nbsp;in a program.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What is the problem? (hint: &lt;em&gt;ildasm&lt;/em&gt; is your friend)&lt;/li&gt;
&lt;li&gt;How can we refactor the method to avoid it?&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282539" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">709@http://11011.net/</guid>
			<dc:subject>Programming</dc:subject>
			<dc:date>2007-06-20T15:19:59+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000709.xml</wfw:commentRss>
			<slash:comments>1</slash:comments>
		</item>
		<item>
			<title>RikReader has expired again!</title>
			<link>http://11011.net/archives/000707.html</link>
			<description>&lt;p&gt;As usual I managed to miss the time-bomb expiry date, sorry! A new build is up now with some small fixes and a new expiry date. Launch RikReader &lt;em&gt;twice&lt;/em&gt; or &lt;a href="http://11011.net/clickonce/rikreader_x86/RikReader.application"&gt;Click Here&lt;/a&gt; to update.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282540" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">707@http://11011.net/</guid>
			<dc:subject>RikReader</dc:subject>
			<dc:date>2007-06-02T00:40:08+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000707.xml</wfw:commentRss>
			<slash:comments>1</slash:comments>
		</item>
		<item>
			<title>Visual Studio to HTML (vs2html.exe)</title>
			<link>http://11011.net/archives/000705.html</link>
			<description>&lt;p&gt;My &lt;a href="http://get.live.com/betas/writer_betas"&gt;Windows Live Writer&lt;/a&gt; plugin, "&lt;a href="http://gallery.live.com/liveitemdetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;amp;pl=8&amp;amp;bt=9"&gt;Paste from Visual Studio&lt;/a&gt;" has been doing quite well, with almost 1000 downloads since last November.&lt;/p&gt; &lt;p&gt;But not everyone uses &lt;em&gt;Writer&lt;/em&gt; and there far are more scenarios for converting source code to HTML than just blog posting. As a result, I've created a little utility which takes the current contents of the clipboard and replaces it with the converted HTML.&lt;/p&gt; &lt;p&gt;The utility, &lt;em&gt;vs2html.exe&lt;/em&gt;, has no user-interface, no options, and no error handling. I find it's best used by adding it to the quick launch menu - then just&amp;nbsp;CTRL-C in VS, hit the icon, and CTRL-V wherever you need the HTML.&lt;/p&gt; &lt;p&gt;You &lt;em&gt;can&lt;/em&gt; configure &lt;em&gt;vs2html&lt;/em&gt; to use a specific font and size instead of the default (Consolas, 12). To do this just to &lt;em&gt;rename&lt;/em&gt; the executable using the format "vs2html.consolas.12.exe" (vs2html.&lt;em&gt;font&lt;/em&gt;.&lt;em&gt;size&lt;/em&gt;.exe).&lt;/p&gt; &lt;p&gt;&lt;a href="http://11011.net/track/files/vs2html.exe"&gt;Download vs2html.exe&lt;/a&gt; (24kb) &lt;a href="http://11011.net/track/files/vs2html.zip"&gt;vs2html.zip&lt;/a&gt;&amp;nbsp;(6kb)&lt;/p&gt; &lt;p&gt;Sample:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: rgb(43,145,175)"&gt;ContentProperty&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;&lt;span style="background: rgb(255,255,0)"&gt;"Child"&lt;/span&gt;&lt;/span&gt;)]
&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;AdornerPopup&lt;/span&gt; : &lt;span style="color: rgb(43,145,175)"&gt;Adorner&lt;/span&gt;, &lt;span style="color: rgb(255,0,0)"&gt;IAddChild&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Output:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;pre&lt;/span&gt; &lt;span style="color: rgb(255,0,0)"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;="font-family:consolas;font-size:12"&amp;gt;&lt;/span&gt;[&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="color: rgb(255,0,0)"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;="color:rgb(43,145,175)"&amp;gt;&lt;/span&gt;...
&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="color: rgb(255,0,0)"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;="color:Blue"&amp;gt;&lt;/span&gt;public&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="color: rgb(255,0,0)"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;="color:Blue"&amp;gt;&lt;/span&gt;class&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;span&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;span&lt;/span&gt; &lt;span style="color: rgb(255,0,0)"&gt;s...&lt;/span&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282541" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">705@http://11011.net/</guid>
			<dc:subject />
			<dc:date>2007-05-18T15:57:31+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000705.xml</wfw:commentRss>
			<slash:comments>6</slash:comments>
		</item>
		<item>
			<title>Observable LINQ, Part 2</title>
			<link>http://11011.net/archives/000704.html</link>
			<description>&lt;p&gt;In &lt;a href="http://11011.net/archives/000703.html"&gt;Part 1&lt;/a&gt;, I introduced &lt;em&gt;StackedList&amp;lt;T&amp;gt;,&lt;/em&gt; a virtual list of observable sub-lists.&lt;/p&gt; &lt;p&gt;More recently I've been working on a cross between a ListBox and a TreeView (putting hierarchical data inside a list - the exact opposite of ATC's &lt;a href="http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx"&gt;TreeListView&lt;/a&gt;). This has some nice benefits: multiple selection, filtering, virtualisation, sorting (although to be honest, sorting an entire&amp;nbsp;TreeView proves an interesting, but perhaps not so useful experience).&lt;/p&gt; &lt;p&gt;To convert a Tree into a List,&amp;nbsp;we have&amp;nbsp;to flatten the data structure. In a tree, a single node is an entity with a value and a list of children. After conversion to a list, a node &lt;em&gt;becomes&lt;/em&gt; a list where the &lt;em&gt;head&lt;/em&gt; of the list is the value, and the &lt;em&gt;tail&lt;/em&gt; is the list of descendent values.&lt;/p&gt; &lt;p&gt;Here's the magic method that kicks this all off:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255,0,0)"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;&amp;gt; &lt;span style="color: rgb(0,0,128)"&gt;CreateList&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;value&lt;/span&gt;)
{
    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;value&lt;/span&gt;).&lt;span style="color: rgb(0,0,128)"&gt;items&lt;/span&gt;;
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;The constructor, and &lt;em&gt;items&lt;/em&gt; are both private, so perhaps&amp;nbsp;this seems bizzare at first. But remember, the head of the resultant list &lt;em&gt;is&lt;/em&gt; the &lt;em&gt;TreeListItem&lt;/em&gt; that corresponds to the value that was passed in:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;items&lt;/span&gt; = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;StackedList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;&amp;gt;(
    &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;[] { &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt; });&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;em&gt;TreeListItem&lt;/em&gt; extends &lt;em&gt;ListBoxItem&lt;/em&gt;&amp;nbsp;and pushes some bits around to wire up&amp;nbsp;&lt;em&gt;HierarchicalDataTemplates&lt;/em&gt; like the real &lt;em&gt;TreeView&lt;/em&gt; does.&amp;nbsp;At some later point in time, the item is expanded, and the children&amp;nbsp;&lt;em&gt;ItemsSource&lt;/em&gt; is bound.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;PopulateChildren&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;Collections&lt;/span&gt;.&lt;span style="color: rgb(255,0,0)"&gt;IList&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;newValue&lt;/span&gt;)
{
    ...

    &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;flattenedChildren&lt;/span&gt; =
        &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;FlattenedList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;&amp;gt;(
            &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ConvertedList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt;, &lt;span style="color: rgb(255,0,0)"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;&amp;gt;&amp;gt;(
                &lt;span style="color: rgb(0,0,128)"&gt;Utils&lt;/span&gt;.&lt;span style="color: rgb(43,145,175)"&gt;IList&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;UntypedToTyped&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(0,0,128)"&gt;newValue&lt;/span&gt;),
                &lt;span style="color: rgb(0,0,255)"&gt;delegate&lt;/span&gt;(&lt;span style="color: rgb(0,0,255)"&gt;object&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;value&lt;/span&gt;)
                {
                    &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;TreeListItem&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;value&lt;/span&gt;).&lt;span style="color: rgb(0,0,128)"&gt;items&lt;/span&gt;;
                }));

    &lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;items&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;AddCollection&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;flattenedChildren&lt;/span&gt;);
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Tada! More virtual lists. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;FlattenedList&amp;lt;T&amp;gt;&lt;/em&gt; uses a &lt;em&gt;StackedList&amp;lt;T&amp;gt;&lt;/em&gt; internally to convert an &lt;em&gt;IList&amp;lt;IList&amp;lt;T&amp;gt;&amp;gt;&lt;/em&gt;, a list of lists, into &lt;em&gt;IList&amp;lt;T&amp;gt;&lt;/em&gt;. So, &lt;em&gt;FlattenedList&lt;/em&gt; is used to flatten a list of &lt;em&gt;child&lt;/em&gt; lists into a single list - which then becomes the &lt;em&gt;tail&lt;/em&gt; of the list for the current node.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;ConvertedList&amp;lt;TInput, T&amp;gt;&lt;/em&gt; uses a conversion delegate to convert an &lt;em&gt;IList&amp;lt;TInput&amp;gt;&lt;/em&gt; to an &lt;em&gt;IList&amp;lt;T&amp;gt;. ConvertedList&lt;/em&gt; is used here to take the list of child nodes of type&amp;nbsp;&lt;em&gt;object&lt;/em&gt;, promote these into &lt;em&gt;TreeListItems&lt;/em&gt; and then return the list corresponding to each node. So this &lt;em&gt;ConvertedList&lt;/em&gt; takes an &lt;em&gt;IList&amp;lt;object&amp;gt;&lt;/em&gt; and presents an &lt;em&gt;IList&amp;lt;IList&amp;lt;TreeListItem&amp;gt; -&lt;/em&gt; which is then flattened into the parent nodes as described above.&lt;/p&gt;
&lt;p&gt;To be as generic as possible, my &lt;em&gt;TreeListItems&lt;/em&gt; support binding to child lists of the non-generic type &lt;em&gt;IList &lt;/em&gt;or some generic &lt;em&gt;IList&amp;lt;T&amp;gt;,&amp;nbsp;&lt;/em&gt;in future I'll probably extend this support to any type that at least implements&amp;nbsp;&lt;em&gt;IEnumerable&lt;/em&gt;.&lt;em&gt;&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Utils.IList.UnTypedToTyped&amp;lt;T&amp;gt;(IList list)&lt;/em&gt; dynamically promotes a non-generic list into a read-only strongly typed &lt;em&gt;IList&amp;lt;T&amp;gt;&lt;/em&gt;. This is supported by a couple of additional collection wrapper classes: &lt;em&gt;UpcastList&lt;/em&gt; and&amp;nbsp;&lt;em&gt;DowncastList&lt;/em&gt; for dealing with &lt;em&gt;IList&amp;lt;T&amp;gt;&lt;/em&gt; of some other &lt;em&gt;T&lt;/em&gt;, and &lt;em&gt;ObjectList&lt;/em&gt; for dealing with a non-generic list.&lt;/p&gt;
&lt;p&gt;All the classes mentioned here virtualise the &lt;em&gt;INotifyCollectionChanged&lt;/em&gt; events raised by child collections. The end result is that&amp;nbsp;we can flatten an entire hierarchical data structure of observable lists into a single, virtual, observable list.&lt;/p&gt;
&lt;p&gt;Stay tuned for part 3, where we will&amp;nbsp;harness the power of virtual lists together&amp;nbsp;with the syntactic goodness of LINQ.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282542" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">704@http://11011.net/</guid>
			<dc:subject>Windows Presentation Foundataion</dc:subject>
			<dc:date>2007-05-14T20:17:04+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000704.xml</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Observable LINQ, Part 1</title>
			<link>http://11011.net/archives/000703.html</link>
			<description>&lt;p&gt;Here's a simple &lt;a href="http://msdn.microsoft.com/data/ref/linq/"&gt;LINQ&lt;/a&gt; query in C# 3.0:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; people = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43,145,175)"&gt;Person&lt;/span&gt;&amp;gt;();
&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; friends = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;string&lt;/span&gt;&amp;gt;();

&lt;span style="color: rgb(0,0,255)"&gt;var&lt;/span&gt; myFriendsAges = 
    &lt;span style="color: rgb(0,0,255)"&gt;from&lt;/span&gt; p &lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt; people
    &lt;span style="color: rgb(0,0,255)"&gt;join&lt;/span&gt; f &lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt; friends &lt;span style="color: rgb(0,0,255)"&gt;on&lt;/span&gt; p.Name &lt;span style="color: rgb(0,0,255)"&gt;equals&lt;/span&gt; f
    &lt;span style="color: rgb(0,0,255)"&gt;select&lt;/span&gt; p.Age;&lt;/pre&gt;
&lt;p&gt;Using &lt;em&gt;ObservableCollection&amp;lt;T&amp;gt;&lt;/em&gt; from .NET 3.0 doesn't buy us anything that &lt;em&gt;List&amp;lt;T&amp;gt;&lt;/em&gt; wouldn't. We end up creating an ordinary sequence, &lt;em&gt;IEnumerable&amp;lt;int&amp;gt;&lt;/em&gt;. But, it doesn't have to be this way, LINQ is easily extended. Read on.&lt;/p&gt;
&lt;p&gt;For use in &lt;a href="http://11011.net/software/rikreader"&gt;RikReader's&lt;/a&gt;&amp;nbsp;hierarchical view&amp;nbsp;I implemented a new collection class, &lt;em&gt;StackedList&amp;lt;T&amp;gt;&lt;/em&gt;. This is similar to &lt;em&gt;System.Windows.Data.CompositeCollection&lt;/em&gt; in that I can flatten multiple collections into a single list. But &lt;em&gt;StackedList&lt;/em&gt; is far more generic, it will directly flatten any &lt;em&gt;IList&amp;lt;T&amp;gt;,&lt;/em&gt; and should the child list implement &lt;em&gt;INotifyCollectionChanged&lt;/em&gt;, the collection change events are remapped such that&amp;nbsp;&lt;em&gt;StackedList&lt;/em&gt; is able to provide a complete read-only illusion of a virtual collection.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(43,145,175)"&gt;StackedList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt; &lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt; = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;StackedList&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;();
&lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;WriteLine&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Count&lt;/span&gt;); &lt;span style="color: rgb(0,128,0)"&gt;// -&amp;gt; "0"

&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt; &lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt; = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;();
&lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Add&lt;/span&gt;(1);
&lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;AddCollection&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt;);
&lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;WriteLine&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Count&lt;/span&gt;); &lt;span style="color: rgb(0,128,0)"&gt;// -&amp;gt; "1"

&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Add&lt;/span&gt;(2);
&lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;WriteLine&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Count&lt;/span&gt;); &lt;span style="color: rgb(0,128,0)"&gt;// -&amp;gt; "2"
&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;WriteLine&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;&lt;span style="background: rgb(255,255,0)"&gt;"{0}, {1}"&lt;/span&gt;&lt;/span&gt;, &lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt;[0], &lt;span style="color: rgb(0,0,128)"&gt;list&lt;/span&gt;[1]); &lt;span style="color: rgb(0,128,0)"&gt;// -&amp;gt; "1, 2"&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;If we tried to write the same program using &lt;em&gt;CompositeCollection&lt;/em&gt;&amp;nbsp;we'd probably end up with something like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(43,145,175)"&gt;CompositeCollection&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;composite&lt;/span&gt; = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;CompositeCollection&lt;/span&gt;();
&lt;span style="color: rgb(43,145,175)"&gt;CollectionView&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;view&lt;/span&gt; = &lt;span style="color: rgb(43,145,175)"&gt;CollectionViewSource&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;GetDefaultView&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;composite&lt;/span&gt;) &lt;span style="color: rgb(0,0,255)"&gt;as&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;CollectionView&lt;/span&gt;;
&lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;WriteLine&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;view&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Count&lt;/span&gt;); &lt;span style="color: rgb(0,128,0)"&gt;// -&amp;gt; "0"

&lt;/span&gt;&lt;span style="color: rgb(43,145,175)"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt; &lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt; = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt;&amp;gt;();
&lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Add&lt;/span&gt;(1);
&lt;span style="color: rgb(43,145,175)"&gt;CollectionContainer&lt;/span&gt; &lt;span style="color: rgb(0,0,128)"&gt;container&lt;/span&gt; = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;CollectionContainer&lt;/span&gt;();
&lt;span style="color: rgb(0,0,128)"&gt;container&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Collection&lt;/span&gt; = &lt;span style="color: rgb(0,0,128)"&gt;childList&lt;/span&gt;;
&lt;span style="color: rgb(0,0,128)"&gt;composite&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Add&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;container&lt;/span&gt;);
&lt;span style="color: rgb(43,145,175)"&gt;Console&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;WriteLine&lt;/span&gt;(&lt;span style="color: rgb(0,0,128)"&gt;view&lt;/span&gt;.&lt;span style="color: rgb(0,0,128)"&gt;Count&lt;/span&gt;); &lt;span style="color: rgb(0,128,0)"&gt;// -&amp;gt; "1"&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Even though &lt;em&gt;CollectionView&lt;/em&gt; has a &lt;em&gt;Count &lt;/em&gt;property, it doesn't implement &lt;em&gt;IList&lt;/em&gt;, it actually exposes a new list like interface &lt;em&gt;ICollectionView&lt;/em&gt;&amp;nbsp;which is &lt;em&gt;IEnumerable&lt;/em&gt;. &lt;em&gt;CollectionView&lt;/em&gt; is also non-generic, but notwithstanding, it is a similar approach.&lt;/p&gt;
&lt;p&gt;With &lt;em&gt;StackedList&lt;/em&gt; I was easily able to flatten a hierarchy of Feeds and Folders into a single, observable list of Items - which was then directly &lt;em&gt;bindable&lt;/em&gt; for visualisation.&lt;/p&gt;
&lt;p&gt;Stay tuned for Part 2, where we will explore the application of some other virtual lists.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/11011net/~4/130282543" height="1" width="1"/&gt;</description>
			<guid isPermaLink="false">703@http://11011.net/</guid>
			<dc:subject>Windows Presentation Foundataion</dc:subject>
			<dc:date>2007-05-14T18:10:46+10:00</dc:date>
			<dc:creator>Douglas Stockwell</dc:creator>
			<wfw:commentRss>http://11011.net/archives/comment-000703.xml</wfw:commentRss>
			<slash:comments>1</slash:comments>
		</item>

	</channel>
</rss>
