<?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: An example on how to format file size in C#</title>
	<atom:link href="http://fatagnus.com/an-example-on-how-to-format-file-size-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://fatagnus.com/an-example-on-how-to-format-file-size-in-c/</link>
	<description>One is glad to be of service</description>
	<pubDate>Fri, 12 Mar 2010 01:31:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: eelledge</title>
		<link>http://fatagnus.com/an-example-on-how-to-format-file-size-in-c/comment-page-1/#comment-40555</link>
		<dc:creator>eelledge</dc:creator>
		<pubDate>Wed, 15 Apr 2009 13:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://fatagnus.com/an-example-on-how-to-format-file-size-in-c/#comment-40555</guid>
		<description>I changed all of the longs to floats and this works great. I added it to the FileHelpers class I already had and it is a great fit.

  Thank You</description>
		<content:encoded><![CDATA[<p>I changed all of the longs to floats and this works great. I added it to the FileHelpers class I already had and it is a great fit.</p>
<p>  Thank You</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Garman</title>
		<link>http://fatagnus.com/an-example-on-how-to-format-file-size-in-c/comment-page-1/#comment-20883</link>
		<dc:creator>Adam Garman</dc:creator>
		<pubDate>Tue, 09 Dec 2008 15:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://fatagnus.com/an-example-on-how-to-format-file-size-in-c/#comment-20883</guid>
		<description>Nice code snippet.

I noticed one slight inconsitency. Your argument to ToString suggest that you want to format the number to 2 decimal places but because your divide is in integer arithmetic you have lost this information. The decimal places will always read ".00". I suggest either:

(a) Convert your division to floating point arithmetic. E.g. 
if (bytes &gt; terabyte) return (bytes / (double)terabyte).ToString("0.00 TB");

(b) Drop the decimal places. E.g.
if (bytes &gt; terabyte) return (bytes / terabyte).ToString("0 TB");</description>
		<content:encoded><![CDATA[<p>Nice code snippet.</p>
<p>I noticed one slight inconsitency. Your argument to ToString suggest that you want to format the number to 2 decimal places but because your divide is in integer arithmetic you have lost this information. The decimal places will always read &#8220;.00&#8243;. I suggest either:</p>
<p>(a) Convert your division to floating point arithmetic. E.g.<br />
if (bytes &gt; terabyte) return (bytes / (double)terabyte).ToString(&#8221;0.00 TB&#8221;);</p>
<p>(b) Drop the decimal places. E.g.<br />
if (bytes &gt; terabyte) return (bytes / terabyte).ToString(&#8221;0 TB&#8221;);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
