<?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: Closures in C#: Variable Scoping and Value Types vs Reference Types</title>
	<atom:link href="http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/</link>
	<description>Better Than Yesterday</description>
	<lastBuildDate>Mon, 20 May 2013 17:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Foobar</title>
		<link>http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/#comment-2257</link>
		<dc:creator>Foobar</dc:creator>
		<pubDate>Sun, 26 Feb 2012 23:46:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types.aspx#comment-2257</guid>
		<description>the code blocks are all truncated..</description>
		<content:encoded><![CDATA[<p>the code blocks are all truncated..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derick.bailey</title>
		<link>http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/#comment-192</link>
		<dc:creator>derick.bailey</dc:creator>
		<pubDate>Tue, 24 Feb 2009 14:53:11 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types.aspx#comment-192</guid>
		<description>@Freddy,

with a proper understanding of references vs. value types - how values are stored on the stack and how references are pointers on the stack that point to the heap - there is little to no difference in the behavior of values vs references in closures. 

however, if a person doesn&#039;t understand the distinction between a value type and a reference type, they may think that the referenced object will be copied in the same way a value type will, which is incorrect. 

i was trying to illustrate this difference, really. not sure i accomplished that, though.</description>
		<content:encoded><![CDATA[<p>@Freddy,</p>
<p>with a proper understanding of references vs. value types &#8211; how values are stored on the stack and how references are pointers on the stack that point to the heap &#8211; there is little to no difference in the behavior of values vs references in closures. </p>
<p>however, if a person doesn&#8217;t understand the distinction between a value type and a reference type, they may think that the referenced object will be copied in the same way a value type will, which is incorrect. </p>
<p>i was trying to illustrate this difference, really. not sure i accomplished that, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Freddy</title>
		<link>http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/#comment-191</link>
		<dc:creator>Freddy</dc:creator>
		<pubDate>Tue, 24 Feb 2009 14:40:02 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types.aspx#comment-191</guid>
		<description>Note that scoping the value type inside the loop behaves the same as the reference type:

for (int i = 0; i &lt;= 3; i++)
       {
           int copy = i;
           Func&lt;int&gt; foo = (() =&gt; { return copy; });
           theActions.Add(foo);
       }

I only read it quickly, but I am not sure there is really nothing different on the reference vs. value behavior for closures in C#.</description>
		<content:encoded><![CDATA[<p>Note that scoping the value type inside the loop behaves the same as the reference type:</p>
<p>for (int i = 0; i < = 3; i++)<br />
       {<br />
           int copy = i;<br />
           Func<int> foo = (() => { return copy; });<br />
           theActions.Add(foo);<br />
       }</p>
<p>I only read it quickly, but I am not sure there is really nothing different on the reference vs. value behavior for closures in C#.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kpullin</title>
		<link>http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/#comment-190</link>
		<dc:creator>Kpullin</dc:creator>
		<pubDate>Tue, 24 Feb 2009 04:33:47 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types.aspx#comment-190</guid>
		<description>@fernando - you can use two fingers to scroll around in the code block (div?). It is awkward and an anoying user experience, but it does work. </description>
		<content:encoded><![CDATA[<p>@fernando &#8211; you can use two fingers to scroll around in the code block (div?). It is awkward and an anoying user experience, but it does work. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fernando</title>
		<link>http://lostechies.com/derickbailey/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types/#comment-189</link>
		<dc:creator>Fernando</dc:creator>
		<pubDate>Mon, 23 Feb 2009 22:05:48 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2009/02/23/closures-in-c-variable-scoping-and-value-types-vs-reference-types.aspx#comment-189</guid>
		<description>I wish safari on the iPhone would allow me to see the code blocks. I mean can see them but only partially not the whole block. I can&#039;t even scroll.</description>
		<content:encoded><![CDATA[<p>I wish safari on the iPhone would allow me to see the code blocks. I mean can see them but only partially not the whole block. I can&#8217;t even scroll.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
