<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Bill Blogs in C#</title><link>http://srtsolutions.com/blogs/billwagner/default.aspx</link><description>Bill Wagner discusses C#, LINQ, and other items of interest</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/billwagner" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>C# can now consume indexed properties</title><link>http://feedproxy.google.com/~r/billwagner/~3/cTMQLz0xDno/c-can-now-consume-indexed-properties.aspx</link><pubDate>Sun, 01 Nov 2009 19:39:35 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:23812</guid><dc:creator>wwagner</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=23812</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/11/01/c-can-now-consume-indexed-properties.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/kirillosenkov/default.aspx"&gt;Kirill Osenkov&lt;/a&gt; provides some details on this &lt;a href="http://blogs.msdn.com/kirillosenkov/archive/2009/10/20/indexed-properties-in-c-4-0.aspx"&gt;feature&lt;/a&gt; that was added in Beta 2 of C#4.0. I must admit a certain ambivalence toward this feature. On the one hand, this feature will make working with Office COM APIs even easier (as Kirill shows). On the other hand, I fear a rising chorus asking to implement defining indexed properties in C#. That would be a mistake. It would end muddling the waters of what objects ‘owned’ other objects and properties.&amp;#160; &lt;/p&gt;  &lt;p&gt;foo.SomeProperty[3] &lt;/p&gt;  &lt;p&gt;could represent two very different object models. Is SomeProperty a type that implements an indexer? Or is SomeProperty a property of foo that requires an index? That starts to matter quite a bit when you wonder about LINQ queries and other ways to access whatever data is behind SomeProperty.&lt;/p&gt;  &lt;p&gt;I’m close to thinking that I’d have preferred this change wasn’t made. It’s a bit troubling to think that the language accepted changes solely to support interop with COM style APIs. But as long as the indexed properties remain in a box, and are only used for that particular scenario, it won’t be a serious concern.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=23812" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/cTMQLz0xDno" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/11/01/c-can-now-consume-indexed-properties.aspx</feedburner:origLink></item><item><title>Advice for Public Speakers</title><link>http://feedproxy.google.com/~r/billwagner/~3/vz-TSFw76x0/advice-for-public-speakers.aspx</link><pubDate>Tue, 27 Oct 2009 03:01:58 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:20775</guid><dc:creator>wwagner</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=20775</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/10/26/advice-for-public-speakers.aspx#comments</comments><description>&lt;p&gt;A friend of mine asked me for some pointers relating to giving technical talks recently. We had a great discussion and I thought that some of the advice was general enough that I would share it here. Many of us are involved in user groups, and we (as a community) owe it to our other members to help everyone learn.&lt;/p&gt;  &lt;p&gt;Of course, I’m not the world’s authority on speaking, and I have quite a bit to learn. I want to hear your speaking tips as well.&lt;/p&gt;  &lt;h3&gt;Tell a Story&lt;/h3&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;p&gt;View your talk as a story, in the literary sense. This has a lot of implications in your talk.&amp;#160; First, think about books you really like (or even a movie). The very beginning hooks the audience immediately. You may not know much about the story yet, but you are hooked.&amp;#160; You need to know more. OK, I admit that very few tech talks have the same hook as “Raiders of the Lost Ark”. But still, work on the hook as much as you can. &lt;/p&gt;  &lt;p&gt;Next, continuing the ‘story’ analogy, consider the different components of your talk as characters in the story.&amp;#160; Your story (at least for this talk) revolves around one topic.&amp;#160; All other topics. are supporting characters. They are part of the story, but they have supporting roles. Do not spend more time on these supporting roles than they deserve. That limits your ability to tell the main story. These supporting characters can be covered, but only in such as these supporting characters tell your main story.&amp;#160; Look through your slides, and your samples and look for opportunities to focus on your main story rather than these supporting characters. For example, if your talk is about C# 4.0, you may use a Silverlight application to demonstrate the features. Concentrate on C# 4.0, not Silverlight. (Of course, if your talk is about Silverlight, you do exactly the opposite).&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;Everyone Needs Practice&lt;/h3&gt;  &lt;p&gt;Listen to yourself. Do you have an verbal tics? ‘Um’, ‘So…’, Most of us have them. Work on minimizing those tics. They will hurt your delivery.&lt;/p&gt;  &lt;p&gt;Mix up the slides and demos. Almost all great speakers split up the cadence of their talk. They do some discussion. Then some demos. Back to slides, or a story, and onward. Staying in any one of those styles for too long will lose the audience.&lt;/p&gt;  &lt;h3&gt;Demos need the Most Practice&lt;/h3&gt;  &lt;p&gt;Let’s talk about demos. That is the hardest part.&amp;#160; It’s hard because we usually don’t speak while we are coding, and no one likes ‘dead air’. That’s why I use the trick of saying what I’m coding.&amp;#160; It avoids ‘dead air’ and I’ve never been able to code one thing while saying something else.&amp;#160; It’s usually something like:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt; “I’ll new up a List of Employees so that I can run a few queries. We’ll have to initialize it with some data. (see note one below).&amp;#160; Now that we’ve got a collection let’s find the most expensive employees. That’s a query from emp in employees where salary is …” &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;By talking through the code, you can keep your focus. &lt;/p&gt;  &lt;p&gt;Note: some code is not relevant to your talk, like initializing a collection with a bunch of values. Use a snippet, or already have that written. When you practice, you’ll spot these. They are the bits of code that you don’t want to talk about, because they aren’t part of the story.&amp;#160; Just put them in place, and move on. It will give you more time to talk about your main story.&lt;/p&gt;  &lt;h3&gt;Have the crutches handy&lt;/h3&gt;  &lt;p&gt;There are two crutches I have ready all the time: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Snippets for bits of code I forget. Everything I type is on the snippet clipboard, in case I forget something. I try not to just paste code, but it helps to know that I can grab those if something bombs.&lt;/li&gt;    &lt;li&gt;The finished demo somewhere on disk. I’ve often forgot some small bit needed to make the demo work right. It’s easy to do on stage. And, when a demo doesn’t work, it’s easy to get really nervous really fast. Therefore, I always have a way to get to the finished working demo quickly. When the demo bombs, I’ll try to fix it once. If I can’t get it working with one quick session, I punt and say something like “I must have forgotten something, so let’s load the finished solution and look at it. We’ll find what I missed, and you’ll never forget to do that again. Especially if forgetting it means your demo doesn’t work and look foolish on stage.” Then, I load the finished solution. I run and prove to the audience that it works. Then, I look at the code and explain what’s in the pre-loaded solution that wasn’t in the demo that broke. (Trust me, it’s really easy to find.) &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Finally, you have to use the big font. And, you have to practice with it because that will make sure you format code so it looks good on the big screen. &lt;/p&gt;  &lt;p&gt;The more you practice, the better you’ll be. Talk to any experienced speaker, and you’ll hear stories of when that person gave a talk that felt like a failure. They are great speakers because they learned from that experience. Everyone can do it, but it does take practice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=20775" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/vz-TSFw76x0" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/User+Groups/default.aspx">User Groups</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Me/default.aspx">Me</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/10/26/advice-for-public-speakers.aspx</feedburner:origLink></item><item><title>VS2010 Beta 2, Release dates, and More</title><link>http://feedproxy.google.com/~r/billwagner/~3/65acvgOtl8s/vs2010-beta-2-release-dates-and-more.aspx</link><pubDate>Mon, 19 Oct 2009 17:39:00 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:18983</guid><dc:creator>wwagner</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=18983</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/10/19/vs2010-beta-2-release-dates-and-more.aspx#comments</comments><description>&lt;p&gt;You probably noticed that Visual Studio 2010 Beta 2 was released for download today (for MSDN subscribers). The general release will be Wednesday (Oct 21).&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve had limited time (obviously) to work with this, but I&amp;rsquo;m already impressed.&amp;nbsp; The WPF editor has shown lots of progress. It&amp;rsquo;s much more responsive than in earlier beta builds. The language features (at least for C#) are coming along well. &lt;/p&gt;
&lt;p&gt;That bodes well for the &lt;strong&gt;announced release date of March 22, 2010.&lt;/strong&gt; Yes, they&amp;rsquo;ve placed a stake in the ground, and this release has an official launch date. &lt;/p&gt;
&lt;p&gt;In addition, Microsoft made some announcements about MSDN licensing and pricing.&amp;nbsp; Microsoft has the full announcement &lt;a href="http://www.microsoft.com/presspass/press/2008/sep08/09-29VS10PR.mspx"&gt;here&lt;/a&gt;. There are a couple of interesting items that are very important in this announcement:&lt;/p&gt;
&lt;p&gt;1. Every Visual Studio Premium license includes Team Foundation Server with 1 Cal. That means if your team has VS Premium, you can use TFS right out of the box. &lt;/p&gt;
&lt;p&gt;2. WIndows Azure &amp;ldquo;Development and Test Use&amp;rdquo;. Visual Studio Premium (and above) will include compute hours (and data storage) in Windows Azure for test purposes. (UPDATE:&amp;nbsp; The full terms are &lt;a href="http://msdn.microsoft.com/en-gb/subscriptions/ee461076.aspx"&gt;here&lt;/a&gt;.) VS2010 with Premium MSDN will get (initially) 750 hours of compute time per month, 10 Gigabytes of storage, and more).&lt;/p&gt;
&lt;p&gt;That promises to be a very exciting 2010!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=18983" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/65acvgOtl8s" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/upcoming+attractions/default.aspx">upcoming attractions</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Azure/default.aspx">Azure</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/10/19/vs2010-beta-2-release-dates-and-more.aspx</feedburner:origLink></item><item><title>Lazy&lt;T&gt;: On Demand Construction in .NET 4.0</title><link>http://feedproxy.google.com/~r/billwagner/~3/6sy6qQTkQzI/lazy-lt-t-gt-on-demand-construction-in-net-4-0.aspx</link><pubDate>Wed, 30 Sep 2009 23:32:00 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:17098</guid><dc:creator>wwagner</dc:creator><slash:comments>11</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=17098</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/09/30/lazy-lt-t-gt-on-demand-construction-in-net-4-0.aspx#comments</comments><description>&lt;p&gt;I love it when I find those small new bits of functionality in the .NET framework. It&amp;rsquo;s all the big items that get all the love at conferences and in magazines. &lt;/p&gt;
&lt;p&gt;Lazy&amp;lt;T&amp;gt; is one of those items.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s imagine you&amp;rsquo;re writing an application and in some scenarios, but not others,&amp;nbsp; you need a particular object. Furthermore, suppose that object you need is very expensive to create and use. You don&amp;rsquo;t want to create it everytime your application runs. You only want to create it when you need it. &lt;/p&gt;
&lt;p&gt;Sure, you could manage all that yourself, but Lazy&amp;lt;T&amp;gt; makes it easy.&amp;nbsp; You just create a lazy wrapper on the expensive object:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;Lazy&amp;lt;ExpensiveResource&amp;gt; ownedResource = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Lazy&amp;lt;ExpensiveResource&amp;gt;();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can simply reference &amp;lsquo;ownedResource.Value&amp;rsquo; to get at the expensive object. The first time you access ownedResource.Value, the expensive resource will get allocated, but not before.&lt;/p&gt;
&lt;p&gt;Lazy&amp;lt;T&amp;gt; also has a boolean propoerty, named IsValueCreated, that you can check to see if the value has been created. That would be useful when you need to store information from the expensive resource, but only if it&amp;rsquo;s been used.&lt;/p&gt;
&lt;h3&gt;Supporting Types without default constructors&lt;/h3&gt;
&lt;p&gt;Lazy&amp;lt;T&amp;gt; does not enforce the new() constraint. You can use Lazy&amp;lt;T&amp;gt; for types that must be instantiated using a different constructor, or even a factory method. A second constructor specifies a Func&amp;lt;T&amp;gt; that returns the new expensive resource:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;Lazy&amp;lt;ExpensiveResource&amp;gt; ownedResource = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Lazy&amp;lt;ExpensiveResource&amp;gt;(&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    () =&amp;gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ExpensiveResource(&lt;span style="color:#006080;"&gt;&amp;quot;filename.data&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can use this second constructor to better control what code creates the expensive resource. I&amp;rsquo;ve used a different constructor here, but you could use a factory method, an IOC container, or any method.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;We&amp;rsquo;re living in a Multi Core World&lt;/h3&gt;
&lt;p&gt;There are two other constructors in Lazy&amp;lt;T&amp;gt;:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Lazy(&lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; isThreadSafe);&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Lazy(Func&amp;lt;T&amp;gt; valueFactory, &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; isThreadSafe);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;These two constructors indicate that you are running in a multi-threaded envrionment, and the lazy construction of of the owned object must be synchronized. (After all, it&amp;rsquo;s an expensive resource. You don&amp;rsquo;t want two of them.)&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a simple type, but it&amp;rsquo;s one of those types you&amp;rsquo;ll find yourself reaching for over and over again.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m glad it&amp;rsquo;s been added.&lt;/p&gt;
&lt;div style="width:468px;height:70px;"&gt;


&lt;a href="http://lakequincy.com?471" style="text-align:right;font-size:8px;display:block;color:#000;text-decoration:none;font-family:Sans-Serif;margin:0;padding:0;"&gt;Ads by Lake Quincy Media&lt;/a&gt; &lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=17098" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/6sy6qQTkQzI" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/.NET+General/default.aspx">.NET General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/DevCenterPosts/default.aspx">DevCenterPosts</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/09/30/lazy-lt-t-gt-on-demand-construction-in-net-4-0.aspx</feedburner:origLink></item><item><title>The CodePlex Foundation: Cautiously Optimistic</title><link>http://feedproxy.google.com/~r/billwagner/~3/sj9xUUjRxWU/the-codeplex-foundation-cautiously-optimistic.aspx</link><pubDate>Thu, 17 Sep 2009 15:39:20 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:15773</guid><dc:creator>wwagner</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=15773</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/09/17/the-codeplex-foundation-cautiously-optimistic.aspx#comments</comments><description>&lt;p&gt;With some fanfare, the CodePlex Foundation launched itself late last week (&lt;a href="http://www.codeplex.org"&gt;http://www.codeplex.org&lt;/a&gt;).&amp;#160; This has generated quite a bit of discussion on blogs, twitter, email lists, podcasts, and everything else.&lt;/p&gt;  &lt;p&gt;I’m optimistic, with some reservations about how this will play out.&lt;/p&gt;  &lt;p&gt;I’ll preface this discussion with the obvious disclaimer: I am not a lawyer. My knowledge of copyright law comes from asking quite a few questions of editors and attorneys before signing the contracts for the books and articles I’ve written. This is not legal advice. It can’t be because I’m not licensed to practice law.&lt;/p&gt;  &lt;h3&gt;The Barriers to Open Source Adoption&lt;/h3&gt;  &lt;p&gt;In my day job, I work with a number of large companies.&amp;#160; Many of them have explicit policies against using Open Source code.&amp;#160; In addition, some ask for indemnification against IP claims for &lt;em&gt;purchased closed source&lt;/em&gt; software. That’s a reasonable action, given the current state of our legal system, the very small number of people that understand software, and the amount of cash that large companies need in order to operate. (It takes a lot of money to make payroll for 100,000 employees). &lt;/p&gt;  &lt;p&gt;The probability of using stolen IP is small. That’s why many smaller companies accept that risk (sometimes without thinking). But, the cost of being wrong is very high. Furthermore, because of the way copyright law works, the users of open source software are at risk. If you incorporate stolen IP into your business, it doesn’t matter if you did it knowingly or not, you are at risk of civil penalty. &lt;/p&gt;  &lt;p&gt;So imagine you’re the CIO of a big company. You no longer want to spend your days looking at code. You’ve got important meetings to attend. What’s the answer to using Open Source?&amp;#160; Do you have someone perform the research and due diligence to satisfy your fiduciary duty?&amp;#160; Of course not. You (as CIO) are still responsible. It’s easier to just say no. Sure it costs more money to reinvent something. But it’s legal. Sure it costs more to pick a commercial solution. But you can ask for indemnification in exchange for buying the licenses.&lt;/p&gt;  &lt;p&gt;In short, the risk of outsized penalties keeps commercial software developers from benefiting from, and therefore participating in, open source projects.&lt;/p&gt;  &lt;h3&gt;Purchasing Indemnification&lt;/h3&gt;  &lt;p&gt;But wait you say.&amp;#160; Isn’t Linux used in many large organizations?&amp;#160; Certainly. In many of those cases, the large enterprise has purchased the software. Or, more accurately, the company has purchased indemnification against lawsuits. The company providing the software (RedHat, IBM, etc) and the license is accepting the risk, and is using the fees to do what they need to minimize their own risk.&lt;/p&gt;  &lt;p&gt;This is pure opinion.&amp;#160; I believe that part of Microsoft’s motivation for the CodePlex foundation is to make it easier for large enterprises to use .NET based Open Source projects. Note that many of the Open Source projects in widespread use today are championed by IBM, and run on the Linux Operating System. I believe Microsoft wants to enable the CodePlex Foundation to make a stronger ecosystem for .NET projects. Those .NET projects that are part of the CodePlex Foundation may find better adoption rates at large enterprises. &lt;/p&gt;  &lt;h3&gt;Copyright Assignment&lt;/h3&gt;  &lt;p&gt;One of the items on the CodePlex Foundation that is causing lots of concern is the sample license agreement that assigns copyright to the CodePlex Foundation. Here, I’m leaning heavily on my experience with publishers. &lt;/p&gt;  &lt;p&gt;First of all, the only way you can assign copyright to another party is if it is yours. OK, that’s obvious, but I think lots of people are missing that. When I sign the contract for a book with a publisher, I do assign the copyright to the publisher (in return for some considerations). The publisher needs me to warrant that the work is &lt;strong&gt;*my original work*&lt;/strong&gt;.&amp;#160; The same would be true for Open Source software projects. Hypothetically, for me to assign my OSS project’s copyright, I would have to assert that it’s my original work.&lt;/p&gt;  &lt;p&gt;There is another way to assign copyright, which will be necessary for CodePlex and OSS to work. If you ask everyone that contributes to your OSS project to assign the copyright to the project (or you), you do hold the copyright, and therefore you can assign it. (The Apache Foundation Individual Contributor License Agreement contains language necessary to assign the copyright over.)&lt;/p&gt;  &lt;p&gt;Note that you can (as the original author) grant a non-exclusive license as an alternative to assigning the copyright. That’s also common in many OSS contributor agreements. I’m not sure how much weight that gives in IP legal entanglements, but it seems to work for the Apache Foundation, and the MySQL organization. I’ll defer to others with more knowledge.&lt;/p&gt;  &lt;p&gt;I’d imagine you could grant an exclusive license, but I’ve never seen that. &lt;/p&gt;  &lt;h3&gt;What the Codeplex Foundation can accomplish&lt;/h3&gt;  &lt;p&gt;Here’s the funny bit, and why the CodePlex can be a very strong positive force.&amp;#160; The originator of a work can’t assign copyright to ‘a project’. Copyright must be assigned to a legal entity. That means a person, a corporation, some other business entity, a non-profit organization, or government entity. The CodePlex foundation is a legal entity, and can be the recipient of a copyright assignment.&lt;/p&gt;  &lt;p&gt;The foundation has deeper pockets than most Open Source project leaders I know. I imagine that will continue to be true. The Foundation will, I believe, defend those copyrights that have been assigned to it. &lt;/p&gt;  &lt;p&gt;Every book author knows this drill: if your book is successful, websites will spout up that let people download an electronic copy for free.&amp;#160; When I find one of those, my only action is to let my publisher know about it. Some of the sites disappear, so it’s clear that the publisher’s attorneys have taken some action. I expect the CodePlex foundation to take similar action (and to take defensive action) when legal issues of IP ownership arise for those patents that have been assigned to it.&lt;/p&gt;  &lt;p&gt;My opinion is that the CodePlex Foundation is enabling ownership of copyrights in order to provide an umbrella to protect users of its projects.&lt;/p&gt;  &lt;p&gt;Note: I have no idea what, if any, recourse the Foundation, or a project owner, would have regarding a non-exclusive grant of use. See IANAL disclaimer at the beginning of this post.&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;Why do I care?&lt;/h3&gt;  &lt;p&gt;We just released an alpha of our first Open Source project (&lt;a href="http://elevate.codeplex.com"&gt;http://elevate.codeplex.com&lt;/a&gt;). I didn’t know what to expect. The experience was very positive. I enjoyed the project. I enjoyed the attitude that this project engendered even more. &lt;/p&gt;  &lt;p&gt;The most interesting attitude change working with Open Source was that you view the source as the product, rather than the the object code. Often when you’re working, and a ship deadline approaches, you may feel pressure to defer work that isn’t necessary to meet the shipping deliverables. Maybe there’s some refactoring that doesn’t happen. Maybe there are some algorithms that don’t get updated to use a more modern technique. You have to ship, and no one sees the underlying code, so maybe that work gets delayed.&lt;/p&gt;  &lt;p&gt;Working on Open Source gives you a different perspective.&amp;#160; The source is the product. It must work. That’s necessary, but not sufficient. People are looking at the source in order to evaluate your project. The quality must show in the source, and in the test code. This change in the deliverable manifests itself in a change in our collective attitude toward work. We release in different (smaller) cycles. We focus on the internal source quality as well as the external behavioral quality when we discuss release gates.&lt;/p&gt;  &lt;p&gt;That won’t necessarily raise the quality of code. I’ve seen very bad Open Source code. I’ve used closed source products that have excellent quality. And yet, it’s hard to ignore my change in attitude while working. It had the best of both worlds.&amp;#160; I enjoyed working on production code (which I don’t get while working on samples for articles and books). I enjoyed creating source that would help other developers learn (like writing books and articles). It really was the best of both worlds.&lt;/p&gt;  &lt;p&gt;That makes me interested in working in more Open Source projects. It makes me want Open Source projects to succeed.&lt;/p&gt;  &lt;h3&gt;How to evaluate the future&lt;/h3&gt;  &lt;p&gt;One of the most promising aspects of the Soft Launch of the ColdePlex Foundation is that Microsoft has not released this ‘totally baked’. They are openly asking for opinions, participation, and intend to replace the interim board with a permanent (er, permanent for one term. see the bylaws) board. I would expect Microsoft to be represented, but I would not expect them to have a true majority. &lt;/p&gt;  &lt;p&gt;I think the board of advisors (or a software due diligence committee) could be more interesting. Somehow, the CodePlex Foundation will need to make a decision on every project that asks to join the foundation. Should it be accepted? One of the most important tasks around that decision is to determine the pedigree of the code that makes up the project. As I said earlier, the probability is small, but the risks are great. One of the greatest services the Foundation could provide would be reference legal documents and accompanying procedures for running a project, accepting patches, and inviting contributors that minimizes the risk associated with IP ownership. &lt;/p&gt;  &lt;p&gt;Furthermore, running their organization so that large enterprises feel confident using those projects that are part of the Foundation would be a huge service.&lt;/p&gt;  &lt;p&gt;My criteria for measuring the success of the CodePlex Foundation in six months are these:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The community is satisfied with the Foundation’s governance structure. &lt;/li&gt;    &lt;li&gt;At least 20 new projects in the CodePlex Foundation. &lt;/li&gt;    &lt;li&gt;At least one Fortune 50 company has adopted at least one CodePlex Foundation project. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If the CodePlex Foundation achieves that, I’ll be very happy.&lt;/p&gt;  &lt;h3&gt;My own Call to Action&lt;/h3&gt;  &lt;p&gt;I’m excited enough about the CodePlex Foundation to take action.&amp;#160; Here’s my TODO list:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Continue to participate in the discussions online, and in any other way that I can.&lt;/li&gt;    &lt;li&gt;Start or continue at least one project that gets accepted by the CodePlex Foundation. (I want to experience the process of getting a project accepted by the Foundation first hand.)&lt;/li&gt;    &lt;li&gt;Contribute to someone else’s CodePlex Foundation project. (I want to experience how the foundation treats external contributors first hand.)&lt;/li&gt;    &lt;li&gt;Convince one customer to use a CodePlex Foundation project. (Yes, this is probably predicated on the previous two items.)&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;What are you going to do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=15773" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/sj9xUUjRxWU" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/SRT+Solutions/default.aspx">SRT Solutions</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/.NET+General/default.aspx">.NET General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/SrtInsights/default.aspx">SrtInsights</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Elevate/default.aspx">Elevate</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/09/17/the-codeplex-foundation-cautiously-optimistic.aspx</feedburner:origLink></item><item><title>Long time, no Euler (or YAEPS # 13)</title><link>http://feedproxy.google.com/~r/billwagner/~3/U_CLAlXZjKI/long-time-no-euler-or-yaeps-13.aspx</link><pubDate>Wed, 26 Aug 2009 03:15:30 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:14443</guid><dc:creator>wwagner</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=14443</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/08/25/long-time-no-euler-or-yaeps-13.aspx#comments</comments><description>&lt;p&gt;Well, it’s been a long time since I’ve taken the time to solve and blog about one of the Euler problems.&amp;#160; It was time to pick this up again.&lt;/p&gt;  &lt;p&gt;Problem 13 says:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Work out the first 10 digits of the sum of the following one-hundred 50-digit numbers. &amp;lt;long list of numbers elided&amp;gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The key here is that you only need the first 10 digits of the answer. Therefore, you only need to add the first 11 digits for each of the 100 numbers. Here’s why:&amp;#160; These numbers do not contain any 0’s in the first position.&amp;#160; Therefore, the sum of all the first digits is at least 100. The first digit contributes at least 3 digits in the final answer. Once you get to the 11th digit, that number can’t be great than 900. (100 9’s).&amp;#160; It won’t affect anything in the first 10 digits.&amp;#160; That’s the end of the work.&lt;/p&gt;  &lt;p&gt;That makes the final answer one LINQ query:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     var finalAnswer = (from index &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; Enumerable.Range(0, 11)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;                        from s &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; listOfDigits&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;                        select &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt;.Parse(s[index].ToString()) * &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;                        (&lt;span style="color:#0000ff;"&gt;long&lt;/span&gt;)Math.Pow(10, 11 - index)).&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;                        Sum();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;     Console.WriteLine(finalAnswer);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;listOfDigits (elided) is a list of strings where each string contains the digits for one number. &lt;/p&gt;

&lt;p&gt;The first line of the query creates an enumeration for the first 11 digits.&lt;/p&gt;

&lt;p&gt;The next two lines select a single character from each string, parsing that character to create an integer.&lt;/p&gt;

&lt;p&gt;Next, do a little math to move that single digit into the correct column for the sum.&lt;/p&gt;

&lt;p&gt;Finally, sum all the integers.&lt;/p&gt;

&lt;p&gt;Sweet, huh?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=14443" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/U_CLAlXZjKI" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/DevCenterPosts/default.aspx">DevCenterPosts</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Euler/default.aspx">Euler</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/08/25/long-time-no-euler-or-yaeps-13.aspx</feedburner:origLink></item><item><title>Elevate: SRT Solutions first Open Source Project</title><link>http://feedproxy.google.com/~r/billwagner/~3/XeN-11Cfiqs/elevate-srt-solutions-first-open-source-project.aspx</link><pubDate>Wed, 19 Aug 2009 12:29:16 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:13906</guid><dc:creator>wwagner</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=13906</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/08/19/elevate-srt-solutions-first-open-source-project.aspx#comments</comments><description>&lt;p&gt;Chris Marinos started Elevate as a learning time project at SRT Solutions.&amp;#160; It’s still very young, but it’s already very useful to me. &lt;/p&gt;  &lt;p&gt;Chris wrote a great &lt;a href="http://srtsolutions.com/blogs/chrismarinos/archive/2009/08/19/introducing-elevate.aspx" target="_blank"&gt;introductory post&lt;/a&gt; on the library, which is hosted on &lt;a href="http://elevate.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Elevate contains methods we use, usually based on LINQ queries, or otherwise built on top of the .NET BCL.&amp;#160; There are methods to build sequences, sub-divide very large sequences into chunks, perform pattern matching on sequences, and some general purpose composable APIs.&lt;/p&gt;  &lt;p&gt;It’s still a very young project, and we’re adding functionality on a regular basis. We’re also actively seeking other community members’ input and contribution. Please visit the project, join and submit ideas. Or, just download it, try it, and suggest ideas on the CodePlex pages.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=13906" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/XeN-11Cfiqs" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/SRT+Solutions/default.aspx">SRT Solutions</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/08/19/elevate-srt-solutions-first-open-source-project.aspx</feedburner:origLink></item><item><title>When Cast&lt;T&gt; doesn’t Cast to T</title><link>http://feedproxy.google.com/~r/billwagner/~3/63YymZ9z3gQ/when-cast-lt-t-gt-doesn-t-cast-to-t.aspx</link><pubDate>Thu, 23 Jul 2009 03:04:04 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:12708</guid><dc:creator>wwagner</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=12708</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/07/22/when-cast-lt-t-gt-doesn-t-cast-to-t.aspx#comments</comments><description>&lt;p&gt;A friend asked me about some issues he was having using Enumerable.Cast&amp;lt;T&amp;gt;(). In his mind, it just wasn’t working. Like so many problems, it was working correctly, just not the way he expected. It’s worth examining.&lt;/p&gt;  &lt;p&gt;Examine this class:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; MyType&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; String StringMember { get; set; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;implicit&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;operator&lt;/span&gt; String(MyType aString)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; aString.StringMember;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;&amp;#160; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;implicit&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;operator&lt;/span&gt; MyType(String aString)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; MyType { StringMember = aString };&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum13"&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum14"&gt;  14:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Note:&amp;#160; I normally recommend against conversions, (See Item 28 in Effective C#), but that’s the key to this issue.&lt;/p&gt;

&lt;p&gt;Consider this code (assume that GetSomeSttrings() returns a sequence of strings)&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; var answer1 = GetSomeStrings().Cast&amp;lt;MyType&amp;gt;();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (var v &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; answer1)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;         Console.WriteLine(v);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (InvalidCastException)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt;     Console.WriteLine(&lt;span style="color:#006080;"&gt;&amp;quot;Cast Failed!&amp;quot;&lt;/span&gt;);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You’d expect that GetSomeStrings().Cast&amp;lt;MyType&amp;gt;() would correctly convert each string to a MyType usingthe implicit conversion operator defined in MyType. It doesn’t, it throws an InvalidCastException.&lt;/p&gt;

&lt;p&gt;The above code is equivalent to this construct, using a query expression:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; var answer3 = from MyType v &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; GetSomeStrings()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt;               select v;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (var v &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; answer3)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum6"&gt;   6:&lt;/span&gt;         Console.WriteLine(v);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (InvalidCastException)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum9"&gt;   9:&lt;/span&gt; {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum10"&gt;  10:&lt;/span&gt;     Console.WriteLine(&lt;span style="color:#006080;"&gt;&amp;quot;Cast failed again&amp;quot;&lt;/span&gt;);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum11"&gt;  11:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The type declaration on the range variable is converted to a call to Cast&amp;lt;MyType&amp;gt; by the compiler (See Item 36 in More Effective C#). Again, it throws an InvalidCastException.&lt;/p&gt;

&lt;p&gt;Here’s one way to restructure the code so that it works:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; var answer2 = from v &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; GetSomeStrings()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt;               select (MyType)v;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (var v &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; answer2)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum4"&gt;   4:&lt;/span&gt;     Console.WriteLine(v);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;What’s the difference? The two versions that don’t work use Cast&amp;lt;T&amp;gt;(), and the version that works includes the cast in the lambda used as the argument to Select().&lt;/p&gt;

&lt;p&gt;And, that’s where the difference lies. &lt;/p&gt;

&lt;h3&gt;Cast&amp;lt;T&amp;gt;() Cannot access User Defined Conversions&lt;/h3&gt;

&lt;p&gt;When the compiler creates IL for Cast&amp;lt;T&amp;gt;, it can only assume the functionality in System.Object. System.Object does not contain any conversion methods, therefore, Cast&amp;lt;T&amp;gt;() does not generate any IL that might call any conversion operators.&lt;/p&gt;

&lt;p&gt;Cast&amp;lt;T&amp;gt;() will only succeed if its argument is not derived from the target (or a type that implements the target if the target is an interface), Cast&amp;lt;T&amp;gt; fails. &lt;/p&gt;

&lt;p&gt;On the other hand, placing the cast in the lambda for the Select clause enables the compiler to know about the conversion operators in the MyType class. That means in succeeds.&lt;/p&gt;

&lt;p&gt;As I’ve pointed out before, I normally view Conversion operators as a code smell. On occasion, they are useful, but often they’ll cause more problems than they are worth. Here, without the conversion operators, no developer would be tempted to write the example code that didn’t work.&lt;/p&gt;

&lt;p&gt;Of course, if I’m recommending not to use conversion operators, I should offer an alternative.&amp;#160; MyType already contains a read/write property to store the string property, so you can just remove the conversion operators and write either of these constructs:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum1"&gt;   1:&lt;/span&gt; var answer4 = GetSomeStrings().Select(n =&amp;gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; MyType { StringMember = n });&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum2"&gt;   2:&lt;/span&gt; var answer5 = from v &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; GetSomeStrings()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#606060;" id="lnum3"&gt;   3:&lt;/span&gt;               select &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; MyType { StringMember = v };&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Also, if you needed to, you could create a different constructor for MyType.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=12708" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/63YymZ9z3gQ" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Effective+C_2300_/default.aspx">Effective C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/.NET+General/default.aspx">.NET General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/DevCenterPosts/default.aspx">DevCenterPosts</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/07/22/when-cast-lt-t-gt-doesn-t-cast-to-t.aspx</feedburner:origLink></item><item><title>Will you thrive, or be left behind?</title><link>http://feedproxy.google.com/~r/billwagner/~3/LbkMntSDXgE/will-you-thrive-or-be-left-behind.aspx</link><pubDate>Sat, 18 Jul 2009 20:10:13 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:12591</guid><dc:creator>wwagner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=12591</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/07/18/will-you-thrive-or-be-left-behind.aspx#comments</comments><description>&lt;p&gt;A few events recently uncovered a very interesting observation on how developers are hired: the business world often focuses developers toward the exact behavior it claims it doesn’t want. How many times have you heard recently that developers need to have ‘business skills’ and ‘understand the business problem’ and ‘talk to the business side of the house’. I agree that these are important skills for a modern professional developer. However, let’s look at the recruiting process for developers. How much of the developer recruiting process is focused on specific developer tool skills: years of Java, years of ASP.NET, C# and SQL experience, years working with Oracle, or whatever tool is needed in the job description. Really smart developers without those skills will lose out on an opportunity early in the screening process. That’s because they have the relevant business knowledge, and the relevant software construction knowledge, but not the latest buzzwords in the resumes. &lt;/p&gt;  &lt;p&gt;Immediately, the law of unintended consequences starts to rear its ugly head because of this phenomena. Developers know this is how the recruiting project works. Their next job relies on their ability to gain relevant &lt;em&gt;tooling&lt;/em&gt; experience with modern software construction tools. With that kind of motivation, it should not surprise any manager that her developers crave knowledge and experience with modern tools above any other relevant business experience. &lt;/p&gt;  &lt;p&gt;In fact, I think that the business world gets the very developers they deserve. Companies that recruit based on buzzwords will get developers that intend to advance their careers by padding their resumes with buzzwords.&amp;#160; Companies that look for developers that can think, analyze problems, and deliver software that solves real problems will find those developers.&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;Aligning your skills to your goals&lt;/h3&gt;  &lt;p&gt;What kind of developer do you want to be?&amp;#160; And, equally important, what do you view as your contribution to your company? Is it a set of buzzwords or is it something greater?&lt;/p&gt;  &lt;p&gt;One resource to help you find your way is &lt;a href="http://www.microsoft.com/click/thrivedev/default.aspx" target="_blank"&gt;Thrive&lt;/a&gt;, Microsoft’s new site for developers dedicated to advancing their career. This is a site with content from folks inside and outside Microsoft that have important advice and resources that can help you advance your career, even in the current economy.&lt;/p&gt;  &lt;p&gt;There’s information on learning specific tech skills, growing your non-tech skills and helping to highlight them, and how to connect with your community. It’s certainly worth frequent visits.&lt;/p&gt;  &lt;p&gt;And, remember to highlight the skills that make you most valuable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=12591" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/LbkMntSDXgE" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/jobs/default.aspx">jobs</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Software+Engineering/default.aspx">Software Engineering</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/07/18/will-you-thrive-or-be-left-behind.aspx</feedburner:origLink></item><item><title>Book Review: Essential LINQ</title><link>http://feedproxy.google.com/~r/billwagner/~3/zJ8Bxz9O_KE/book-review-essential-linq.aspx</link><pubDate>Mon, 13 Jul 2009 15:08:52 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:12469</guid><dc:creator>wwagner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=12469</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/07/13/book-review-essential-linq.aspx#comments</comments><description>&lt;p&gt;During my recent vacation, I read the final print version of &lt;a href="http://www.amazon.com/Essential-LINQ-Microsoft-NET-Development/dp/0321564162" target="_blank"&gt;Essential LINQ&lt;/a&gt;, by Charlie Calvert and Dinesh Kulkarni.&lt;/p&gt;  &lt;p&gt;Normally, I try to answer the question, “Who should read this book?” That answer eluded me on this book, due to the thorough treatment Charlie and Dinesh give the subject. Essential LINQ is approachable by developers that have minimal experience with LINQ, and yet those developers that have been using LINQ since day one will learn something from this book.&lt;/p&gt;  &lt;h3&gt;The Essence of LINQ and LINQ Patterns and Practices&lt;/h3&gt;  &lt;p&gt;Everyone will learn something from two chapters in this book. “The Essence of LINQ” describes the principles behind the LINQ libraries and language enhancements. By understanding the goals of LINQ, you’ll immediately gain insight that will make LINQ more approachable and more productive for you.&lt;/p&gt;  &lt;p&gt;In chapter 16, toward the end of book, Charlie and Dinesh discuss some patterns you’ll run into while developing with LINQ. You’ll learn how to use LINQ to SQL entities as part of a large multi-tier application. You’ll learn how to improve performance in LINQ applications. You’ll learn how to separate concerns in LINQ based applicaitons. LINQ is too new to be considered complete in terms of ‘best practices’, and thankfully neither Charlie nor Dinesh approach this subject with that kind of arrogance. Instead, they offer their recommendations, and invite discussion on the subject.&lt;/p&gt;  &lt;h3&gt;A catalog of LINQ Functionality&lt;/h3&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;p&gt;Throughout the rest of the book, Charlie and Dinesh explain LINQ to Objects and LINQ to SQL from a usage standpoint, and from an internal design standpoint. In other chapters, LINQ to XML is discussed. The authors provide examples of transforming data between XML and relational storage models as well. In every section, they tie together those features with the concepts discussed in “The Essence of LINQ”. That continuity helps to reinforce your understanding of LINQ through its design concepts.&lt;/p&gt;  &lt;p&gt;After reading this book, you’ll be able to leverage LINQ in all your regular coding tasks. You’ll have a much better understanding of how LINQ works, and when you’ll encounter subtle differences in how different LINQ providers may behave.&lt;/p&gt;  &lt;h3&gt;LINQ to SQL vs. Entity Framework&lt;/h3&gt;  &lt;p&gt;It seems you can’t discuss LINQ without at least wading into the controversy of LINQ to SQL vs. Entity Framework. This book wades there as well (It was finished about the time the first EF release was made). More time is spent on LINQ to SQL, as it is more approachable from an internal design perspective. However, the chapters that cover EF build on that knowledge to help you understand how the two database LINQ technologies are more complementary adversarial. In addition, they touch on when you should consider one over the other in your application.&lt;/p&gt;  &lt;h3&gt;A look at providers&lt;/h3&gt;  &lt;p&gt;This section is the least complete, but the most useful to look into the future of the LINQ universe. It’s too easy to view LINQ as LINQ to Objects, LINQ to SQL, and LINQ to XML, and nothing more. This chapter gives you a brief view some of the other providers people have created for other types of data stores. Looking at some of those providers (especially the IQToolkit) will give you a greater appreciation for how LINQ can be used with a wider variety of data sources than you ever imagined.&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;So, is this book for you?&lt;/h3&gt;  &lt;p&gt;If you are interested in being more productive with LINQ, you should read this book. You’ll probably thumb through it again and again as you search for better ways to solve different problems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=12469" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/zJ8Bxz9O_KE" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/books/default.aspx">books</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/DevCenterPosts/default.aspx">DevCenterPosts</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/BookReviews/default.aspx">BookReviews</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/07/13/book-review-essential-linq.aspx</feedburner:origLink></item><item><title>Reflections on Executive Briefing: Natural User Interface and Social Media</title><link>http://feedproxy.google.com/~r/billwagner/~3/TrpFhMxa2A0/reflections-on-executive-briefing-natural-user-interface-and-social-media.aspx</link><pubDate>Thu, 25 Jun 2009 15:56:56 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:11764</guid><dc:creator>wwagner</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=11764</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/06/25/reflections-on-executive-briefing-natural-user-interface-and-social-media.aspx#comments</comments><description>&lt;p&gt;Once again, we brought together a small group to discuss two more upcoming topics for the software industry. This time it was Natural User Interfaces and Social Media.&lt;/p&gt;  &lt;p&gt;The most interesting observation is that there is a bigger gap between the future-oriented Natural User Interfaces and the closer-to-the-mainstream Social Media topic. That colors this post: In this group we had much more discussion on Social Media than we did on Natural User Interfaces. That&amp;#39;s a function of the group, and the relative adoption of both topics.&lt;/p&gt;  &lt;h4&gt;Natural User Interfaces&lt;/h4&gt;  &lt;p&gt;Natural User Interfaces are a rather nascent topic in our industry. However, I do think that over the next decade, it will become more and more important. The mouse and keyboard metaphor is more than 30 years old. Gaming has clearly gone way beyond mouse and keyboard.&amp;#160; (How long would you play rock band or guitar hero using a mouse and keyboard? Flight Simulators, racing games, and more use custom controllers that are supposedly more natural than the mouse and keyboard metaphor we’re forced to use in our regular line of business applications.&lt;/p&gt;  &lt;p&gt;We’re starting to see some more forward looking computing devices.&amp;#160; iPhone, iPods, Zune, Surface and Windows 7 multi-touch are all examples of a more natural user interface. In all cases, we’re using more natural motions to directly work with the device. &lt;/p&gt;  &lt;p&gt;The conversation lagged somewhat. We didn’t have many of the devices at our disposal that day. Also, it was a bit harder to create a dynamic discussion because it was harder to get conversations about how to these new devices might map to what we do.&lt;/p&gt;  &lt;h4&gt;Social Media&lt;/h4&gt;  &lt;p&gt;Social Media was completely different. This was very lively, and it’s clear how we can all make use of social media for our business and personal endeavors. &lt;/p&gt;  &lt;p&gt;The clearest point here is that the twitter model has won. It’s more interesting than Facebook, LinkedIn, or any other social media platform today. &lt;/p&gt;  &lt;p&gt;The reason is that it provides the best way to reach an authentic audience from an authentic perspective. &lt;/p&gt;  &lt;p&gt;Andy Seidl (&lt;a href="http://twitter.com/faseidl" target="_blank"&gt;@faseidl&lt;/a&gt;) has described twitter as ‘a world wide cocktail party’. That’s a very apt description. You can wade in at any time, you can choose to behave like a professional, or be that person in the corner with the lampshade on his head. You can leave conversations that aren’t interesting. But most importantly, you can engage in real conversations with those people with whom you interact. &lt;/p&gt;  &lt;p&gt;That’s the most interesting part: Social Media must be personal in order to be useful. You can only create an audience by engaging in real conversations. Once you engage in real conversations, you can get real results.&lt;/p&gt;  &lt;p&gt;Social Media also allows you to get around the major barriers to efficiency today.&amp;#160; Our corporate structure exists to allow specialization, which builds walls and silos around different areas, business units, and disciplines. With a twitter presence, I’ve found it easier to reach elected officials, vendors, customers, and collaborators. I haven’t used anything else that has made it easier to reach as many people in as many ways.&lt;/p&gt;  &lt;p&gt;Bud Gibson (&lt;a href="http://twitter.com/Innovators" target="_blank"&gt;@Innovators&lt;/a&gt;) has made significant investments in many areas of social media. He’s also claiming that twitter is a better investment than any other social media. In fact, he’s finding that twitter is better than ‘pay for click’ advertising to reach new prospective customers.&amp;#160; It gets back to Andy’s cocktail party analogy: It’s all about the conversation.&lt;/p&gt;  &lt;p&gt;The bulk of this was about Twitter, although we did discuss other media as well. However, most of the other social media create more walls around different communities. They are ways to interact with people you already know. Facebook and LinkedIN are platforms to talk with people you know. Twitter starts a conversation, and as part of the platform, allows anyone to join and participate. &lt;/p&gt;  &lt;h4&gt;Was there a call to action?&lt;/h4&gt;  &lt;p&gt;There was less of a call to action here. NUI seems a bit farther in the future. The call to action was to ‘keep an eye on it’. It likely will be important, but not immediately for broad reach applications. &lt;/p&gt;  &lt;p&gt;For social media, the call to action was to develop a strategy about how to participate. Your customers are participating. Your competitors likely are too. That means you need to participate, and you need to differentiate yourself with your content.&lt;/p&gt;  &lt;p&gt;Oh, and you can follow my updates on twitter as well: &lt;a href="http://twitter.com/billwagner" target="_blank"&gt;@billwagner&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=11764" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/TrpFhMxa2A0" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Me/default.aspx">Me</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/local+interest/default.aspx">local interest</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Software+Engineering/default.aspx">Software Engineering</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/06/25/reflections-on-executive-briefing-natural-user-interface-and-social-media.aspx</feedburner:origLink></item><item><title>Reflections on Executive Briefing Event: Cloud &amp; RIA</title><link>http://feedproxy.google.com/~r/billwagner/~3/_1OMlO9vt4E/reflections-on-executive-briefing-event-cloud-amp-ria.aspx</link><pubDate>Fri, 19 Jun 2009 21:43:22 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:11565</guid><dc:creator>wwagner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=11565</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/06/19/reflections-on-executive-briefing-event-cloud-amp-ria.aspx#comments</comments><description>&lt;p&gt;Last Tuesday, we hosted our first executive briefing on upcoming technology trends.&amp;#160; The first two topics were Cloud Computing and Rich Internet Applications (RIA). We chose those topics because examples of RIA applications are already around, and cloud computing is on the horizon. It was a great mix of present and future discussion.&lt;/p&gt;  &lt;p&gt;Nerd Note: My regular readers that are looking for core technology content won’t find it here. Our discussions were on the business issues around these technologies. No code samples here, but there were fantastic architecture and design discussions.&lt;/p&gt;  &lt;h4&gt;Cloud Computing&lt;/h4&gt;  &lt;p&gt;I’ll start by saying that I’m personally excited about Cloud Computing. I’m spending time building applications on Azure and Live Framework. &lt;/p&gt;  &lt;p&gt;The opening discussion centered around separating the buzzword “Cloud Computing” from the substantive advantages of using a cloud platform. The ‘Cloud Computing’ buzzword has been attached to many different activities: Google Docs can be considered cloud computing.&amp;#160; So can LiveMail, GMail, or zune marketplace.&amp;#160; LiveMesh is clearly a cloud based application. However, for most of us in the Software Development community, we think of cloud computing as having our own applications running in the cloud.&amp;#160; That means Windows Azure, Amazon’s Elastic Computing Platform, or the Google App Engine. Even those this was an executive type of briefing, we are all in the software industry. We build things, so we look at tools in terms of what we can build. &lt;/p&gt;  &lt;p&gt;From there, we discussed the risks to moving toward cloud computing. There are many.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Current Investments&lt;/strong&gt;: A lot of the large enterprises already have significant investment in their own DataCenters. This will change the economics of moving to the cloud.&amp;#160; Should an enterprise retire its datacenter? If so, at what cost? Having already spent all the money to build a data center, cloud computing will take much longer to generate ROI.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sensitive Data&lt;/strong&gt;:&amp;#160; Others have discussed this as well,but the main concern here is fear.&amp;#160; Many companies have entered into a trust relationship with their customers that involves how the vendor handles the customers’ data. Most vendors are concerned with offloading that trust relationship to a 3rd party. Regardless of how much trust they may place in that 3rd part already, they still have concerns. Cloud platforms increase this concern because not only is the data offsite, the data is somewhere unknown.&amp;#160; You know, ‘it’s in the cloud’.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Spotty Connectivity:&lt;/strong&gt;&amp;#160; We developers tend to locate where we have great connectivity.&amp;#160; It’s almost a prerequisite for where we choose to live and work. However, the same isn’t true for all our customers. Some of them still must live in locations where connectivity is not a given. Or, even if there is great connectivity, it may not have high enough uptimes.&lt;/p&gt;  &lt;p&gt;But of course, we are excited about building software for the cloud, so what are the drivers to build software there? We are we excited about cloud computing?&lt;/p&gt;  &lt;p&gt;Once again, there are a lot of great business drivers for cloud computing.&amp;#160; However, almost all of them turn into one statement:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;em&gt;Cloud Computing is Elastic.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;That implies several drivers for moving applications into the cloud. Economics is the greatest force: Under current models, your data center must be built to handle your peak load. You’ll pay for the infrastructure at all times, even at the minimum load for your application. For applications with seasonal implications (retail, tax applications, Olympics, etc) that can be a huge savings.&lt;/p&gt;  &lt;p&gt;There are other drivers as well.&amp;#160; Scale is a big one.&amp;#160; We work with some researchers that generate terabytes of data every month. That’s an incredible expense, and cloud based computing can lower the storage costs.&lt;/p&gt;  &lt;p&gt;After discussing some of the positives, we did a little comparing on the major announced cloud platforms.&amp;#160; Our index-card sized comparison is this:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Amazon’s Elastic Computing is the most immediate on-ramp to the cloud.&lt;/li&gt;    &lt;li&gt;Google App Engine is a great platform for scripted web applications.&lt;/li&gt;    &lt;li&gt;Windows Azure is a new OS optimized for cloud computing.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here’s why we came to that conclusion:&amp;#160; Amazon’s platform is based on the concept of renting a virtual machine image (either Linux or Windows Server). That makes it the smallest distance from any current application architecture. Google App Engine is optimized for scripting web applications. It’s simple to create web apps there. Windows Azure is setup a bit differently, and enables you to think of an app running ‘in the cloud’ as opposed to running ‘on N servers in the cloud’. That makes it a bit more work to take advantage of the capabilities, but could be a bigger win once there.&lt;/p&gt;  &lt;p&gt;We finished with an interesting question from one of our customers: “Are we recommending cloud computing, and if so, whose cloud?”&lt;/p&gt;  &lt;p&gt;We all weighed in with positive comments.&amp;#160; My own view was that if there weren’t overwhelming negatives (such as resistance to data location), I’ve been recommending cloud based solutions almost exclusively.&amp;#160; Which cloud is trickier. I believe in the Azure vision, because even though you can leverage much of your existing skills, it does make you think about running in a cloud. Therefore, for customers invested in .NET, or open to moving there, it’s my choice. However, it’s not a good idea to recommend porting a large codebase from other platforms (java, php) just to move to Azure.&amp;#160; I know there are some strategies for running those applications in Azure, but I don’t have enough experience there to place big bets on it. And, too many customers with Java or PHP apps have a dependency on MySQL, which doesn’t run in Azure.&amp;#160; When those barriers are in place, Amazon’s Elastic Computing platform makes more sense.&lt;/p&gt;  &lt;p&gt;There’s also a lot of interest from larger companies about running the Azure stack in their own data centers. Interestingly, while I understand some of the justification, I think it’s a short term concern.&amp;#160; Why would you run your own version of the Azure stack instead of pushing your application into the immense scale of a world-wide scale cloud?&lt;/p&gt;  &lt;h4&gt;Rich Internet Applications&lt;/h4&gt;  &lt;p&gt;One great thing about conducting small seminars is that we can set the agenda and veer off that agenda as energy takes us in different directions.&amp;#160; &lt;/p&gt;  &lt;p&gt;On Tuesday we spent more than 3/4 of our time on cloud computing, and finished with a brief look at Rich Internet Applications.&lt;/p&gt;  &lt;p&gt;Or rather, we talked about RunKeeper. (&lt;a href="http://www.runkeeper.com"&gt;www.runkeeper.com&lt;/a&gt;) If you run, and you have an iPhone, this is incredibly cool. Take your iPhone on your run, and it maps the distance, and all elevation changes.&amp;#160; We were discussing things like having it monitor your heartbeat, and monitor your speed (which it may do, I forget which features it does, and which we wished it did). &lt;/p&gt;  &lt;p&gt;This one was a bit less ‘game changing’ than cloud computing.&amp;#160; The overall consensus was that computer users want more. Better interaction, data from any device, and not constrained by the classic browser / forms metaphor.&amp;#160; That means we may be entering a time when browser based applications will be considered ‘legacy applications’ unless they make use of Ajax, Silverlight, Flex or similar tools. It’s fun to develop applications that have different capabilities.&lt;/p&gt;  &lt;h4&gt;Closing&lt;/h4&gt;  &lt;p&gt;This was a wonderful experience. It was fantastic to spend a morning with a tremendous set of brain power, all participating in thoughtful discussions about emerging technologies and how to leverage them to bring more value and more capabilities to our customers.&amp;#160; The best part is that some problems which were considered ‘out of scope’ are suddenly in view.&amp;#160; That’s cool.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=11565" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/_1OMlO9vt4E" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/SRT+Solutions/default.aspx">SRT Solutions</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/local+interest/default.aspx">local interest</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Software+Engineering/default.aspx">Software Engineering</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Azure/default.aspx">Azure</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/06/19/reflections-on-executive-briefing-event-cloud-amp-ria.aspx</feedburner:origLink></item><item><title>Reflections on our Software Development Jam</title><link>http://feedproxy.google.com/~r/billwagner/~3/2V6LFhdR__w/reflections-on-our-software-development-jam.aspx</link><pubDate>Tue, 16 Jun 2009 19:28:24 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:11454</guid><dc:creator>wwagner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=11454</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/06/16/reflections-on-our-software-development-jam.aspx#comments</comments><description>&lt;p&gt;Yesterday, we hosted a Software Development Jam at Automation Alley in Troy, MI (North suburbs of Detroit, MI for those readers not in the Michigan area). &lt;/p&gt;  &lt;p&gt;We billed the event as a way for developers to learn something about those software techniques that we are convinced are the important areas of growth in the future. Those areas were modern software engineering techniques (TDD, Continuous Integration, distributed version control), modern .NET (WPF, Silverlight), and modern Java platform tools (Scala, Jython, JRuby). We spent the morning going over some general software techniques, discussing what kinds of apps we’d want to build, what folks wanted to learn, and why. We spent the afternoon building samples and learning from each other.&lt;/p&gt;  &lt;p&gt;The folks that attended were an interesting mix. We had people&amp;#160; with years of mainframe experience, people that had been teaching C++, and folks in the process of transitioning from IT Pro to developer track careers. &lt;/p&gt;  &lt;p&gt;This was the kind of event that wouldn’t have been possible only a few years in the past. The availability of tools, frameworks, and trial editions helped.&amp;#160; &lt;a href="http://srtsolutions.com/blogs/jaywren/default.aspx" target="_blank"&gt;Jay Wren&lt;/a&gt; setup an SVN server in the meeting room on a spare laptop. Then, he helped everyone get access to it. He also setup a CC.NET server so that all the samples were building throughout the day.&amp;#160; That was a fantastic way to show all the attendees the power of these tools.&amp;#160; If anyone got stuck on a sample later, they could do an SVN update and see a working sample. Others could ask them to checkin their failing build and get help from someone that wasn’t stuck at the time.&amp;#160; And the best part was that everyone could do an &amp;quot;SVN update” and get all the samples before leaving. Of course, everyone could see if anyone made mistakes by monitoring the CC.NET homepage on the internal LAN.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://srtsolutions.com/blogs/mikewoelmer/default.aspx" target="_blank"&gt;Mike Woelmer&lt;/a&gt; led a WPF tutorial in the afternoon. He also gave an overview of the differences between WPF and Silverlight. That helped folks understand when to pick one or the other for a new project. I was coding in Mike’s group, helping folks that got stuck.&amp;#160; I also modified the sample so that much of the middle-tier logic used LINQ style syntax rather than the classic imperative style. Later, Mike and I collaborated on an update to a Windows Forms applications that was multithreaded to give folks an idea on how to use multi-threaded concepts in WPF.&lt;/p&gt;  &lt;p&gt;Meanwhile, &lt;a href="http://srtsolutions.com/blogs/diannemarsh/default.aspx" target="_blank"&gt;Dianne Marsh&lt;/a&gt; was working with a different group building some of the &lt;a href="http://codekata.pragprog.com/" target="_blank"&gt;Code Kata&lt;/a&gt; problems in Scala. &lt;/p&gt;  &lt;p&gt;All in all, we all learned quite a bit about how to apply skills used in one environment to another.&amp;#160; Many of the attendees were stretched to apply what they know to new environments. We were all stretched to explain these new environments in a way that would resonate with people coming from a very different perspective. &lt;/p&gt;  &lt;p&gt;We’ll definitely do more of these in the future.&amp;#160; It was a great way to get information in front of a group of developers and understand the challenges many developers face in adopting new technologies in their current environment. That makes in incumbent upon all of us to do a better job of explaining the value proposition of the latest advances in software development.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=11454" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/2V6LFhdR__w" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/SRT+Solutions/default.aspx">SRT Solutions</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Me/default.aspx">Me</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/local+interest/default.aspx">local interest</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Software+Engineering/default.aspx">Software Engineering</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/06/16/reflections-on-our-software-development-jam.aspx</feedburner:origLink></item><item><title>Azure May CTP is out</title><link>http://feedproxy.google.com/~r/billwagner/~3/ksdbkfXThCM/azure-may-ctp-is-out.aspx</link><pubDate>Mon, 01 Jun 2009 18:53:38 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:11199</guid><dc:creator>wwagner</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=11199</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/06/01/azure-may-ctp-is-out.aspx#comments</comments><description>&lt;p&gt;And, it’s got support for VS2010 Beta 1.&lt;/p&gt;  &lt;p&gt;This is amazingly cool.&amp;#160; I downloaded and installed the Azure May CTP (both the SDK and the Visual Studio Tools (link &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=11b451c4-7a7b-4537-a769-e1d157bad8c6" target="_blank"&gt;here&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;Being that ‘let’s see if we can break this’ kind of person, I ran the same sample in VS2008 and VS2010 on the fabric on my box.&amp;#160; Both ran concurrently without problems.&amp;#160; The developer fabric kept each copy in its own sandbox.&lt;/p&gt;  &lt;p&gt;After you get the Azure toolkit, you can get the samples (separate download for both VS2010 and VS2008) &lt;a href="http://code.msdn.microsoft.com/windowsazuresamples" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=11199" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/ksdbkfXThCM" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/.NET+General/default.aspx">.NET General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/Azure/default.aspx">Azure</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/06/01/azure-may-ctp-is-out.aspx</feedburner:origLink></item><item><title>Not so Hidden Gems in VS 2010</title><link>http://feedproxy.google.com/~r/billwagner/~3/82JtU_2hUGw/not-so-hidden-gems-in-vs-2010.aspx</link><pubDate>Tue, 26 May 2009 21:25:05 GMT</pubDate><guid isPermaLink="false">727bb5a1-3d8b-4cbc-a411-ac1a71136f7d:11057</guid><dc:creator>wwagner</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://srtsolutions.com/blogs/billwagner/rsscomments.aspx?PostID=11057</wfw:commentRss><comments>http://srtsolutions.com/blogs/billwagner/archive/2009/05/26/not-so-hidden-gems-in-vs-2010.aspx#comments</comments><description>&lt;p&gt;I’m just going to assume that all readers of my blog know that Visual Studio 2010 Beta one has been &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" target="_blank"&gt;released&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;I’ve been running it almost exclusively since I downloaded and installed it. There’s a lot to like. For this first post, I’m going to limit my discussion to a very small set of IDE features that thrill me in the new release.&lt;/p&gt;  &lt;h3&gt;Tear away editor and tool windows&lt;/h3&gt;  &lt;p&gt;This is a neat feature for single monitor work, but is absolutely wonderful in a multi-monitor scenario.&amp;#160; In VS2010, you can grab the title tab in an editor window (design or code window) and move it out of the VS IDE frame window. It’s wonderful when you’re trying to do some work that requires examining more than one code file at a time. &lt;/p&gt;  &lt;p&gt;The fact is that this feature works for tool windows as well as editor windows.&amp;#160; In my setup, I’ve tried to maximize my main code window in the main monitor.&amp;#160; Properties, Solution Explorer, and the build output windows are on the secondary monitor. I’ll pull editor windows out when I need to see multiple code (or designer) files for a particular task.&lt;/p&gt;  &lt;h3&gt;PascalCased IntelliSense&lt;/h3&gt;  &lt;p&gt;Love this for discovering classes or methods in the .NET Base Class Libraries. Intellisense now picks up targets that contain the words you type, even if they are not at the beginning. For example, if you type ‘enumer’ in a code window, Intellisense will (as always) contain Enumerable. It will also contain IEnumerable, IOrderedEnumerable, and ParallelEnumerable. &lt;/p&gt;  &lt;p&gt;It’s a great way to discover something that might be the solution to your current coding problems.&lt;/p&gt;  &lt;h3&gt;Real TDD Support: Generate From Usage&lt;/h3&gt;  &lt;p&gt;Create From Usage means you can really follow a TDD methodology. You can right test scenarios that describe how you want to use a class. Once you’ve written the test, you have a test that doesn’t compile (like now). Right click on each item with red squiggles and select “Generate”.&amp;#160; Types allow you to generate a new class (quick default), or “Generate Other” which displays a dialog that lets you select a class, interface, enum, or struct. Furthermore, that dialog lets you select the access modifiers on the type, select a destination project (if you have multiple projects in your solution).&amp;#160; You can follow the same workflow to generate methods or properties once you’ve created the types.&lt;/p&gt;  &lt;p&gt;The IDE will create members that throw NotImplementedExceptions, so all your tests will fail. But, isn’t that the point of TDD?&amp;#160; Once you have those failing tests, you have a task list to make them green.&lt;/p&gt;  &lt;p&gt;In future posts, I’ll touch on more of the major features in VS 2010. I wanted to start with these hidden gems because they can be so easily overlooked if you just start using the new version with your old work patterns.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=11057" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/billwagner/~4/82JtU_2hUGw" height="1" width="1"/&gt;</description><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/.NET+General/default.aspx">.NET General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/C_2300_+General/default.aspx">C# General</category><category domain="http://srtsolutions.com/blogs/billwagner/archive/tags/DevCenterPosts/default.aspx">DevCenterPosts</category><feedburner:origLink>http://srtsolutions.com/blogs/billwagner/archive/2009/05/26/not-so-hidden-gems-in-vs-2010.aspx</feedburner:origLink></item></channel></rss>
