<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Be Careful With the var Keyword and Expression Builders</title>
	<atom:link href="http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=be-careful-with-the-var-keyword-and-expression-builders</link>
	<description></description>
	<lastBuildDate>Sun, 12 Feb 2012 18:54:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: Progressive Interfaces &#124; Elegant Code</title>
		<link>http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/comment-page-1/#comment-46643</link>
		<dc:creator>Progressive Interfaces &#124; Elegant Code</dc:creator>
		<pubDate>Tue, 02 Jun 2009 21:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/#comment-46643</guid>
		<description>[...] Let&#8217;s start by showing a &#8216;traditional&#8217; expression builder like the one I provided in my previous post: [...]</description>
		<content:encoded><![CDATA[<p>[...] Let&#8217;s start by showing a &#8216;traditional&#8217; expression builder like the one I provided in my previous post: [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Experimenting With Fluent Interfaces in the Domain &#124; Elegant Code</title>
		<link>http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/comment-page-1/#comment-44979</link>
		<dc:creator>Experimenting With Fluent Interfaces in the Domain &#124; Elegant Code</dc:creator>
		<pubDate>Sat, 28 Mar 2009 23:49:09 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/#comment-44979</guid>
		<description>[...] you might have guessed from my previous two blog posts, I&#8217;ve been experimenting with fluent interfaces lately. I&#8217;ve been [...]</description>
		<content:encoded><![CDATA[<p>[...] you might have guessed from my previous two blog posts, I&#8217;ve been experimenting with fluent interfaces lately. I&#8217;ve been [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Van Ryswyck</title>
		<link>http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/comment-page-1/#comment-44843</link>
		<dc:creator>Jan Van Ryswyck</dc:creator>
		<pubDate>Mon, 23 Mar 2009 19:43:03 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/#comment-44843</guid>
		<description>@rich: I&#039;m not calling it an expression builder, but Martin Fowler is:
http://martinfowler.com/dslwip/ExpressionBuilder.html</description>
		<content:encoded><![CDATA[<p>@rich: I&#8217;m not calling it an expression builder, but Martin Fowler is:<br />
<a href="http://martinfowler.com/dslwip/ExpressionBuilder.html" rel="nofollow">http://martinfowler.com/dslwip/ExpressionBuilder.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/comment-page-1/#comment-44840</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Mon, 23 Mar 2009 16:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/#comment-44840</guid>
		<description>Hmm, the code provided makes perfect sense to me.  I can&#039;t see how in the initial &quot;expression builder&quot; statement would ever assume that you were looking for an instance of the Product class.  There may be an implicit operator to cast a ProductBuilder as a Product, but the compiler can&#039;t assume that&#039;s what you&#039;re trying to do.  The implicit operator means that you can cast a ProductBuilder to a Product, but not that you must.  The var keyword gets a type for that statement, and no more.  Now, if your first var statement ended with a call to Build() (which might as well be public, given the implicit cast) then the var would easily know it should be a Product and not a ProductBuilder.

Also, be careful with the use of the term &quot;Expression Builder&quot; when referring to .NET 3.0, especially when referring to the keyword &quot;var&quot;.  I was hoping to see some LINQ code in here or the building of an Expression tree, like Charlie describes here: http://blogs.msdn.com/charlie/archive/2008/01/31/expression-tree-basics.aspx</description>
		<content:encoded><![CDATA[<p>Hmm, the code provided makes perfect sense to me.  I can&#8217;t see how in the initial &#8220;expression builder&#8221; statement would ever assume that you were looking for an instance of the Product class.  There may be an implicit operator to cast a ProductBuilder as a Product, but the compiler can&#8217;t assume that&#8217;s what you&#8217;re trying to do.  The implicit operator means that you can cast a ProductBuilder to a Product, but not that you must.  The var keyword gets a type for that statement, and no more.  Now, if your first var statement ended with a call to Build() (which might as well be public, given the implicit cast) then the var would easily know it should be a Product and not a ProductBuilder.</p>
<p>Also, be careful with the use of the term &#8220;Expression Builder&#8221; when referring to .NET 3.0, especially when referring to the keyword &#8220;var&#8221;.  I was hoping to see some LINQ code in here or the building of an Expression tree, like Charlie describes here: <a href="http://blogs.msdn.com/charlie/archive/2008/01/31/expression-tree-basics.aspx" rel="nofollow">http://blogs.msdn.com/charlie/archive/2008/01/31/expression-tree-basics.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop - Weekend Edition - March 21-22, 2009 &#124; Alvin Ashcraft's Morning Dew</title>
		<link>http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/comment-page-1/#comment-44795</link>
		<dc:creator>Dew Drop - Weekend Edition - March 21-22, 2009 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Sun, 22 Mar 2009 12:37:37 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/03/21/be-careful-with-the-var-keyword-and-expression-builders/#comment-44795</guid>
		<description>[...] Be Careful With the var Keyword and Expression Builders (Jan Van Ryswyck) [...]</description>
		<content:encoded><![CDATA[<p>[...] Be Careful With the var Keyword and Expression Builders (Jan Van Ryswyck) [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

