<?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: CSharp VAR Misconceptions</title>
	<atom:link href="http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/</link>
	<description>ASP.NET, HTML, CSS, Visual Studio, CSharp, VB.NET and other programming items of interest.</description>
	<lastBuildDate>Mon, 15 Mar 2010 11:52:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mitch</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3431</link>
		<dc:creator>Mitch</dc:creator>
		<pubDate>Wed, 09 Sep 2009 15:59:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3431</guid>
		<description>@Dennis

var index = 1;

should be avoided only WHEN index is a constant.</description>
		<content:encoded><![CDATA[<p>@Dennis</p>
<p>var index = 1;</p>
<p>should be avoided only WHEN index is a constant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3430</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Wed, 09 Sep 2009 15:52:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3430</guid>
		<description>I use &quot;var&quot; a lot, except some foreach iterators to &quot;xxxCollection&quot; which &quot;var&quot; cannot works very well.

In case I cannot use &quot;var&quot;, or it does not look very well; I should consider to break the method into smaller pieces and renaming stuffs.

&quot;var&quot; really save a lot heartbeat from long type name (e.g. generic)
&quot;var&quot; save some time when we extract a new interface from an object. (especially with a factory method)



&quot;var index = 1;&quot;
should be prevented, because &quot;1&quot; should be a constant.
const int FOO=1; // I mean it
var bar= FOO;</description>
		<content:encoded><![CDATA[<p>I use &#8220;var&#8221; a lot, except some foreach iterators to &#8220;xxxCollection&#8221; which &#8220;var&#8221; cannot works very well.</p>
<p>In case I cannot use &#8220;var&#8221;, or it does not look very well; I should consider to break the method into smaller pieces and renaming stuffs.</p>
<p>&#8220;var&#8221; really save a lot heartbeat from long type name (e.g. generic)<br />
&#8220;var&#8221; save some time when we extract a new interface from an object. (especially with a factory method)</p>
<p>&#8220;var index = 1;&#8221;<br />
should be prevented, because &#8220;1&#8243; should be a constant.<br />
const int FOO=1; // I mean it<br />
var bar= FOO;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gunteman</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3425</link>
		<dc:creator>gunteman</dc:creator>
		<pubDate>Wed, 09 Sep 2009 08:58:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3425</guid>
		<description>@Mitch

Yes, just making sure... :)

CodeRush Express (free) features a &quot;Make Explicit&quot; function which can resolve &quot;vars&quot; when you feel like having the type explicitly declared.</description>
		<content:encoded><![CDATA[<p>@Mitch</p>
<p>Yes, just making sure&#8230; <img src='http://blog.dmbcllc.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>CodeRush Express (free) features a &#8220;Make Explicit&#8221; function which can resolve &#8220;vars&#8221; when you feel like having the type explicitly declared.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Smith</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3424</link>
		<dc:creator>Eric Smith</dc:creator>
		<pubDate>Wed, 09 Sep 2009 08:47:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3424</guid>
		<description>The initial requirement for var was to make things like Linq possible.  These days it&#039;s just a nice way of applying the DRY principle - why repeat yourself when you don&#039;t have to?  On the other hand though, if it is not pretty clear what type we&#039;re dealing with (other than when using anonymous types of course), then it probably makes sense to be explicit about the type.</description>
		<content:encoded><![CDATA[<p>The initial requirement for var was to make things like Linq possible.  These days it&#8217;s just a nice way of applying the DRY principle &#8211; why repeat yourself when you don&#8217;t have to?  On the other hand though, if it is not pretty clear what type we&#8217;re dealing with (other than when using anonymous types of course), then it probably makes sense to be explicit about the type.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitch</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3422</link>
		<dc:creator>Mitch</dc:creator>
		<pubDate>Tue, 08 Sep 2009 21:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3422</guid>
		<description>@gunteman

I think we all know what he meant.</description>
		<content:encoded><![CDATA[<p>@gunteman</p>
<p>I think we all know what he meant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gunteman</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3421</link>
		<dc:creator>gunteman</dc:creator>
		<pubDate>Tue, 08 Sep 2009 21:12:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3421</guid>
		<description>No, it doesn&#039;t save you from casting, it saves you from explicitly declaring.</description>
		<content:encoded><![CDATA[<p>No, it doesn&#8217;t save you from casting, it saves you from explicitly declaring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaspio</title>
		<link>http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/comment-page-1/#comment-3416</link>
		<dc:creator>Jaspio</dc:creator>
		<pubDate>Mon, 07 Sep 2009 13:10:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dmbcllc.com/2009/09/07/csharp-var-misconceptions/#comment-3416</guid>
		<description>I don&#039;t use var that much either. Except in foreach iterators:

foreach (var item in collection) {} 

It saves a lot of trouble casting to the right type there. 
Good point on the right-side assignment though!</description>
		<content:encoded><![CDATA[<p>I don&#8217;t use var that much either. Except in foreach iterators:</p>
<p>foreach (var item in collection) {} </p>
<p>It saves a lot of trouble casting to the right type there.<br />
Good point on the right-side assignment though!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.209 seconds -->
