<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>FxCop backlog themes: Disposition and finalization</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/16/fxcop-backlog-themes-disposition-and-finalization.aspx</link><description>I skipped ahead a while back with my post on the exceptions theme , and it&amp;#39;s time to get back on track with stuff that would usually precede that rather involved topic during an FxCop backlog cleanup project. The good news with the disposition and</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: FxCop backlog themes: Disposition and finalization</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/16/fxcop-backlog-themes-disposition-and-finalization.aspx#912792</link><pubDate>Sat, 19 May 2007 00:43:04 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:912792</guid><dc:creator>calinoiu</dc:creator><description>&lt;p&gt;There are actually some pretty good reasons to explicitly dispose everything that is disposable, even if that disposition ultimately does very little. &amp;nbsp;For example, if you're coding against interfaces or base classes as much as possible, you'll want to ensure that disposition is triggered all the time in order to cover the cases where it actually will have a significant effect (e.g.: if you happen to working with a FileStream rather than a MemoryStream).&lt;/p&gt;
&lt;p&gt;Even if you're not coding against interfaces or base classes, there is no guarantee that any given type's disposition will continue to be quite as trivial in future releases. &amp;nbsp;If you're not disposing your memory streams now and the next version of the .NET Framework adds some significant resource releasing to MemoryStream.Dispose, you may end up with quite a bit of catch-up coding to do.&lt;/p&gt;
&lt;p&gt;To be honest, I have to wonder why one would want to bother avoiding invoking disposition for the trivial cases. &amp;nbsp;After all, if the Dispose method doesn't happen to do much of anything, its performance cost will be tiny, so there doesn't seem to be much point in going out of one's way to avoid executing it.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=912792" width="1" height="1"&gt;</description></item><item><title>re: FxCop backlog themes: Disposition and finalization</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/16/fxcop-backlog-themes-disposition-and-finalization.aspx#911599</link><pubDate>Fri, 18 May 2007 14:31:07 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:911599</guid><dc:creator>Jonathan Perret</dc:creator><description>&lt;p&gt;Thank you for the information. I have another &amp;quot;corner case&amp;quot; for your consideration : do you Dispose instances of MemoryStream ?&lt;/p&gt;
&lt;p&gt;As everyone &amp;quot;knows&amp;quot; it holds no unmanaged resources...&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;--Jonathan&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=911599" width="1" height="1"&gt;</description></item></channel></rss>