<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" 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/"><channel><title>To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx</link><description>GC Myth: setting an object's reference to null will force the GC to collect it right away. GC Truth: setting an object's reference to null will sometimes allow the GC to collect it sooner. As much as you may want to, you can't guarantee the GC will collect</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#273155</link><pubDate>Wed, 01 Dec 2004 18:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273155</guid><dc:creator>Joe</dc:creator><description>I don't think that's a good example for IDisposable.  IDisposable is intended for releasing unmanaged resources, and you don't generally want an object to &amp;quot;hang around&amp;quot; after calling Dispose.&lt;br&gt;Also you should implement a protected Dispose method (unless your class is sealed) and a finalizer as described in MSDN.&lt;br&gt;</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#273185</link><pubDate>Wed, 01 Dec 2004 18:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273185</guid><dc:creator>Chris</dc:creator><description>Joe,&lt;br&gt;&lt;br&gt;Yes, the Dispose Pattern should definitely be used for unmanged resources, but that doesn't mean a Dispose method can't have other legitimate uses.  &lt;br&gt;&lt;br&gt;The above construct is only really useful if you need BigObject to hang around, but no longer need the internal array.  This also allows you to clean up this object in a using clause.  &lt;br&gt;&lt;br&gt;A finalizer and protected Dispose for this class are unnecessary.</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#273252</link><pubDate>Wed, 01 Dec 2004 20:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273252</guid><dc:creator>Kevin Westhead</dc:creator><description>Another example of using null is in the implementation of Stack.Pop(). Items on the stack are held internally in an array, and when Pop is called the size of the stack is adjusted and the former final element in the array is set to null. This means the array doesn't retain popped items and therefore doesn't prevent the GC from reclaiming them when all other external references have gone.</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#273290</link><pubDate>Wed, 01 Dec 2004 21:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273290</guid><dc:creator>Chris</dc:creator><description>Nice non-contrived example Kevin!</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#273309</link><pubDate>Wed, 01 Dec 2004 21:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273309</guid><dc:creator>G. Man</dc:creator><description>I'm somewhat in agreement with Joe about Dispose being for unmanaged resources. &lt;br&gt;&lt;br&gt;Furthermore, Dispose is meant to be called when you are completely done with an object. You seem to be saying that you will call BigObject.Dispose and then continue to use BigObject. This is definitely non-intuitive and certainly is not allowed with any of the CLR types.&lt;br&gt;</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#273317</link><pubDate>Wed, 01 Dec 2004 22:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273317</guid><dc:creator>Chris</dc:creator><description>G. Man&lt;br&gt;&lt;br&gt;Dispose is not necessarily for when you are completely done with an object.  According to the IDisposable MSDN page:&lt;br&gt;&lt;br&gt;&amp;quot;This method is, by convention, used for all tasks associated with freeing resources held by an object, or preparing an object for reuse.&amp;quot; (&lt;a target="_new" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIDisposableClassDisposeTopic.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIDisposableClassDisposeTopic.asp&lt;/a&gt;)&lt;br&gt;&lt;br&gt;You could imagine another method on BigObject that repopulates the internal array after Dispose has been called.  This could be comparable to a Collection's Clear() method.&lt;br&gt;&lt;br&gt;Granted, Dispose is most useful (and should be used) for unmanaged resources, but that doesn't disqualify it from having other uses.</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#275651</link><pubDate>Mon, 06 Dec 2004 14:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275651</guid><dc:creator>Dan Golick</dc:creator><description>Finalize must be used for unmanaged resources and should not be used for managed resources since the finalization order is not guaranteed.&lt;br&gt;&lt;br&gt;Dispose on the other hand can be freely used for managed resources.  Any class that has a field with a disposable object should implement dispose.&lt;br&gt;&lt;br&gt;Dispose and using allow us to implement a &amp;quot;scoped destructor&amp;quot;.  &lt;br&gt;&lt;br&gt;So we can create a lock object that unlocks at the end of the using scope or a timer that stops when leaving the scope.</description></item><item><title>Chroniques d'Am&amp;#233;thyste - Null ou pas null?</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#385452</link><pubDate>Fri, 04 Mar 2005 23:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:385452</guid><dc:creator>TrackBack</dc:creator><description>Chroniques d'Am&amp;amp;#233;thyste - Null ou pas null?</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#448473</link><pubDate>Sat, 06 Aug 2005 10:32:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:448473</guid><dc:creator>Saurabh Nandu</dc:creator><description>Fantastic blog post. Very Very useful!</description></item><item><title>re: To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#583781</link><pubDate>Wed, 26 Apr 2006 06:57:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:583781</guid><dc:creator>Sara</dc:creator><description>Can you give the URL of latest similar posts about assignment of NULL</description></item><item><title>To Null or Not to Null</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#6532433</link><pubDate>Mon, 26 Nov 2007 18:54:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6532433</guid><dc:creator>To Null or Not to Null</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://feeds.maxblog.eu/item_191474.html"&gt;http://feeds.maxblog.eu/item_191474.html&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Garbage Collector: set strong reference to null, why? | keyongtech</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#9361084</link><pubDate>Thu, 22 Jan 2009 04:23:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9361084</guid><dc:creator>Garbage Collector: set strong reference to null, why? | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/451545-garbage-collector-set-strong-reference"&gt;http://www.keyongtech.com/451545-garbage-collector-set-strong-reference&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Chris Lyon s WebLog To Null or Not to Null | unemployment office</title><link>http://blogs.msdn.com/clyon/archive/2004/12/01/273144.aspx#9759892</link><pubDate>Tue, 16 Jun 2009 11:08:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9759892</guid><dc:creator> Chris Lyon s WebLog To Null or Not to Null | unemployment office</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://unemploymentofficeresource.info/story.php?id=1294"&gt;http://unemploymentofficeresource.info/story.php?id=1294&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>