<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Money Type for the CLR</title><link>http://moneytype.codeplex.com/project/feeds/rss</link><description>An implementation of a Money type for the CLR. Embodies much of the &amp;#34;Money&amp;#34; pattern described in Martin Fowler&amp;#39;s &amp;#34;Patterns for Enterprise Application Architecture,&amp;#34; while also adding a bit more functionality and performance by relying on the .Net framework and runtime.</description><item><title>Updated Wiki: Home</title><link>http://moneytype.codeplex.com/wikipage?version=13</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;A convenient money structure for the CLR which carefully handles rounding and currency types.&lt;/h2&gt;
&lt;h1&gt;NOTE: source now at: &lt;a href="https://bitbucket.org/rplaire/money-type-for-the-clr"&gt;https://bitbucket.org/rplaire/money-type-for-the-clr&lt;/a&gt;&lt;/h1&gt;
&lt;h3&gt;Background&lt;/h3&gt;The CLR doesn&amp;#39;t include a native money type. This could be seen as a shortcoming, or a reasonable design decision, given that it is an object-oriented framework, and adding your own type to encapsulate the data and behavior you need is pretty much its reason of being.&lt;br /&gt;&lt;br /&gt;Money, however, is a type which is so primitive, and so pervasive, that it&amp;#39;s absence is notable. Other primitive types are built in, after all. Martin Fowler considers this in &lt;u&gt;Patterns of Enterprise Application Architecture&lt;/u&gt; [&lt;u&gt;PEAA&lt;/u&gt;]:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;A large proportion of the computers in this world manipulate money, so it&amp;#39;s always puzzled me that money isn&amp;#39;t actually a first class data type in any mainstream programming language. The lack of a type causes problems, the most obvious surrounding currencies&lt;/i&gt;. ...&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The good thing about object-oriented programming is that you can fix these problems by creating a Money class that handles them. Of course, it&amp;#39;s still surprising that none of the mainstream base class libraries actually do this.&lt;/i&gt; (p. 488)&lt;br /&gt;
&lt;h3&gt;Approach&lt;/h3&gt;
&lt;b&gt;Money&lt;/b&gt;&lt;br /&gt;In [&lt;u&gt;PEAA&lt;/u&gt;], Martin Fowler and Matt Foemmel&amp;#39;s example shows Money as an object with value semantics. In .Net, a value type is a first-class entity, and so it makes sense to combine these two and make Money a value type. This should also help deal with the issue of performance the authors bring up, since value types are not reference counted on the heap, meaning less pressure on the GC and therefore higher performance. &lt;br /&gt;&lt;br /&gt;Also in [&lt;u&gt;PEAA&lt;/u&gt;], the underlying type used to store the value was an Int64 (long). The authors then scale the value by some power of 10 (0 - 3) to represent fractional units. In this type, I opted to represent the fraction as a completely separate Int32, which is scaled by 10^9 (the largest power of 10 which fits into an Int32). This allows storing much smaller fractions, which is useful for intermediate computations. Due to this, the type a fixed-decimal point numeric representation. This is how relational databases often store money, so it makes a natural fit. Another alternative was to represent the money value with a System.Decimal, as is done here: &lt;a href="http://www.noticeablydifferent.com/CodeSamples/Money.aspx"&gt;http://www.noticeablydifferent.com/CodeSamples/Money.aspx&lt;/a&gt;. The problem with this approach is that System.Decimal is a binary floating-point type, and binary floating-point types give us all sorts of headaches when computing with them and not treating the round-off with extreme care. These issues can be avoided by working with whole numbers and scaling to represent fractions.&lt;br /&gt;&lt;br /&gt;I opted to separate the responsibility to allocate money in a defined distribution into another class: MoneyDistributor. The reasons for this are that I think it helps readability and conscientious use, and having both a divide operation and an allocate operation on the money class seemed to be a bit of a conflict of interest. By separating out the responsibility for not losing (or gaining!) fractions of money into a separate class, I force Money to admit that it can&amp;#39;t really do a good job at dividing itself up, and rather entrusts this to another class. Further, this then allows subclassing of MoneyDistributor for custom behavior, which can no longer be done with Money, since it is a value type.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Currency&lt;/b&gt;&lt;br /&gt;With regard to the Currency aspect of the type, .Net doesn&amp;#39;t have this, but Java does. Java follows ISO 4217, and so it is pretty safe to add something like this to .Net - just follow the spec. My first inclination was to just make a Currency class with static fields: one for each currency. However, &lt;a href="http://www.noticeablydifferent.com/CodeSamples/Money.aspx"&gt;Jason Hunt&amp;#39;s&lt;/a&gt; implementation used a CultureInfo instance to represent the currency, and it got me to think about how this is already somewhat present in the BCL. Since the CultureInfo classes are built around an Int32 identifier known as the LCID, it seems reasonable to use this as the currency identifier as well. However, after some observation, this appears not to be a sound approach: not only are the culture-to-currency relationships not 1-to-1, but they are also not N-to-1, since some cultures use more than one currency. In the end, I used the ISO spec to generate some lookup tables, and keep everything related based on the ISO numeric code for any given currency. This code is an Int32, and this serves as the only field in a Currency instance, allowing me to represent the Currency as a value type as well, making serialization of Money quite simple: there are no reference fields in it! One last functionality of currency to point out: IFormatProvider is implemented on it, so that when ToString() is called on Money, the associated Currency instance is passed with it and it gets formatted as expected.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>codekaizen</author><pubDate>Mon, 18 Mar 2013 17:32:55 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20130318053255P</guid></item><item><title>Updated Wiki: Home</title><link>http://moneytype.codeplex.com/wikipage?version=12</link><description>&lt;div class="wikidoc"&gt;&lt;h2&gt;A convenient money structure for the CLR which carefully handles rounding and currency types.&lt;/h2&gt;
&lt;h3&gt;Background&lt;/h3&gt;The CLR doesn&amp;#39;t include a native money type. This could be seen as a shortcoming, or a reasonable design decision, given that it is an object-oriented framework, and adding your own type to encapsulate the data and behavior you need is pretty much its reason of being.&lt;br /&gt;&lt;br /&gt;Money, however, is a type which is so primitive, and so pervasive, that it&amp;#39;s absence is notable. Other primitive types are built in, after all. Martin Fowler considers this in &lt;u&gt;Patterns of Enterprise Application Architecture&lt;/u&gt; [&lt;u&gt;PEAA&lt;/u&gt;]:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;A large proportion of the computers in this world manipulate money, so it&amp;#39;s always puzzled me that money isn&amp;#39;t actually a first class data type in any mainstream programming language. The lack of a type causes problems, the most obvious surrounding currencies&lt;/i&gt;. ...&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The good thing about object-oriented programming is that you can fix these problems by creating a Money class that handles them. Of course, it&amp;#39;s still surprising that none of the mainstream base class libraries actually do this.&lt;/i&gt; (p. 488)&lt;br /&gt;
&lt;h3&gt;Approach&lt;/h3&gt;
&lt;b&gt;Money&lt;/b&gt;&lt;br /&gt;In [&lt;u&gt;PEAA&lt;/u&gt;], Martin Fowler and Matt Foemmel&amp;#39;s example shows Money as an object with value semantics. In .Net, a value type is a first-class entity, and so it makes sense to combine these two and make Money a value type. This should also help deal with the issue of performance the authors bring up, since value types are not reference counted on the heap, meaning less pressure on the GC and therefore higher performance. &lt;br /&gt;&lt;br /&gt;Also in [&lt;u&gt;PEAA&lt;/u&gt;], the underlying type used to store the value was an Int64 (long). The authors then scale the value by some power of 10 (0 - 3) to represent fractional units. In this type, I opted to represent the fraction as a completely separate Int32, which is scaled by 10^9 (the largest power of 10 which fits into an Int32). This allows storing much smaller fractions, which is useful for intermediate computations. Due to this, the type a fixed-decimal point numeric representation. This is how relational databases often store money, so it makes a natural fit. Another alternative was to represent the money value with a System.Decimal, as is done here: &lt;a href="http://www.noticeablydifferent.com/CodeSamples/Money.aspx"&gt;http://www.noticeablydifferent.com/CodeSamples/Money.aspx&lt;/a&gt;. The problem with this approach is that System.Decimal is a binary floating-point type, and binary floating-point types give us all sorts of headaches when computing with them and not treating the round-off with extreme care. These issues can be avoided by working with whole numbers and scaling to represent fractions.&lt;br /&gt;&lt;br /&gt;I opted to separate the responsibility to allocate money in a defined distribution into another class: MoneyDistributor. The reasons for this are that I think it helps readability and conscientious use, and having both a divide operation and an allocate operation on the money class seemed to be a bit of a conflict of interest. By separating out the responsibility for not losing (or gaining!) fractions of money into a separate class, I force Money to admit that it can&amp;#39;t really do a good job at dividing itself up, and rather entrusts this to another class. Further, this then allows subclassing of MoneyDistributor for custom behavior, which can no longer be done with Money, since it is a value type.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Currency&lt;/b&gt;&lt;br /&gt;With regard to the Currency aspect of the type, .Net doesn&amp;#39;t have this, but Java does. Java follows ISO 4217, and so it is pretty safe to add something like this to .Net - just follow the spec. My first inclination was to just make a Currency class with static fields: one for each currency. However, &lt;a href="http://www.noticeablydifferent.com/CodeSamples/Money.aspx"&gt;Jason Hunt&amp;#39;s&lt;/a&gt; implementation used a CultureInfo instance to represent the currency, and it got me to think about how this is already somewhat present in the BCL. Since the CultureInfo classes are built around an Int32 identifier known as the LCID, it seems reasonable to use this as the currency identifier as well. However, after some observation, this appears not to be a sound approach: not only are the culture-to-currency relationships not 1-to-1, but they are also not N-to-1, since some cultures use more than one currency. In the end, I used the ISO spec to generate some lookup tables, and keep everything related based on the ISO numeric code for any given currency. This code is an Int32, and this serves as the only field in a Currency instance, allowing me to represent the Currency as a value type as well, making serialization of Money quite simple: there are no reference fields in it! One last functionality of currency to point out: IFormatProvider is implemented on it, so that when ToString() is called on Money, the associated Currency instance is passed with it and it gets formatted as expected.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>codekaizen</author><pubDate>Mon, 18 Mar 2013 17:25:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20130318052534P</guid></item><item><title>Commented Issue: Multiply and divide ignore the Currency [3437]</title><link>http://moneytype.codeplex.com/workitem/3437</link><description>&amp;#60;p&amp;#62;operator &amp;#42; and operator &amp;#47; both ignore the Currency of the amount being modified and return a Money for the current culture.  Code should be&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;&amp;#38;&amp;#35;160&amp;#59;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;        public static Money operator &amp;#42;&amp;#40;Money left, Decimal right&amp;#41;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;        &amp;#123;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;            return new Money&amp;#40;&amp;#40;&amp;#40;Decimal&amp;#41;left &amp;#42; right&amp;#41;, left._currency&amp;#41;&amp;#59;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;        &amp;#125;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;&amp;#38;&amp;#35;160&amp;#59;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;        public static Money operator &amp;#47;&amp;#40;Money left, Decimal right&amp;#41;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;        &amp;#123;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;            return new Money&amp;#40;&amp;#40;&amp;#40;Decimal&amp;#41;left &amp;#47; right&amp;#41;, left._currency&amp;#41;&amp;#59;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;        &amp;#125;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;&amp;#38;&amp;#35;160&amp;#59;&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;thanks for prividing this project&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;&amp;#60;p&amp;#62;Paul&amp;#60;&amp;#47;p&amp;#62;&lt;br /&gt;Comments: ** Comment from web user: Marchy ** &lt;p&gt;Agreed, had made the same fix&lt;/p&gt;</description><author>Marchy</author><pubDate>Mon, 22 Oct 2012 02:27:50 GMT</pubDate><guid isPermaLink="false">Commented Issue: Multiply and divide ignore the Currency [3437] 20121022022750A</guid></item><item><title>Source code checked in, #80132</title><link>http://moneytype.codeplex.com/SourceControl/changeset/changes/80132</link><description>Upgrade&amp;#58; New Version of LabDefaultTemplate.xaml. To upgrade your build definitions, please visit the following link&amp;#58; http&amp;#58;&amp;#47;&amp;#47;go.microsoft.com&amp;#47;fwlink&amp;#47;&amp;#63;LinkId&amp;#61;254563</description><author>Project Collection Service Accounts</author><pubDate>Mon, 01 Oct 2012 21:49:39 GMT</pubDate><guid isPermaLink="false">Source code checked in, #80132 20121001094939P</guid></item><item><title>Source code checked in, #80131</title><link>http://moneytype.codeplex.com/SourceControl/changeset/changes/80131</link><description>Checked in by server upgrade</description><author>Project Collection Service Accounts</author><pubDate>Mon, 01 Oct 2012 21:43:10 GMT</pubDate><guid isPermaLink="false">Source code checked in, #80131 20121001094310P</guid></item><item><title>Source code checked in, #55373</title><link>http://moneytype.codeplex.com/SourceControl/changeset/changes/55373</link><description>Checked in by server upgrade</description><author>_TFSSERVICE</author><pubDate>Mon, 02 Aug 2010 22:49:34 GMT</pubDate><guid isPermaLink="false">Source code checked in, #55373 20100802104934P</guid></item><item><title>Created Issue: Money(decimal, Currency) ignores second argument</title><link>http://moneytype.codeplex.com/WorkItem/View.aspx?WorkItemId=3629</link><description>Another subtle glitch&amp;#58; when supplying Currency as a second argument to Money ctor, that arg gets overridden. I think it&amp;#39;s the order of constructor calls that matters.&lt;br /&gt;</description><author>esteewhy</author><pubDate>Fri, 08 May 2009 15:10:59 GMT</pubDate><guid isPermaLink="false">Created Issue: Money(decimal, Currency) ignores second argument 20090508031059P</guid></item><item><title>Commented Issue: Code (re)usability improvements</title><link>http://moneytype.codeplex.com/WorkItem/View.aspx?WorkItemId=3628</link><description>Hello, great work&amp;#33; Found you at CodeProject first, than saw the code here, started using it and found some issues worth mentioning&amp;#58;&lt;br /&gt;&lt;br /&gt;-- I&amp;#39;d like to persist Money type as a string in a custom format, so it&amp;#39;s desirable to know if a given currency code is valid in the system. For this case to work i&amp;#39;ve introduced a Currency.TryParse&amp;#40;..&amp;#41; method with a semantic similar to that of some standard CLR value types.&lt;br /&gt;&lt;br /&gt;-- For UI purpose it&amp;#39;d be cool to have a list of all valid currencies, so i&amp;#39;ve exposed it via static Currency.Currencies property&lt;br /&gt;&lt;br /&gt;-- Presently, there&amp;#39;s no way to know if a given Currency instance represents a valid currency until you try to access any instance property and, possibly, get an InvalidOperationException -- ups, not nice&amp;#33; I&amp;#39;ve made these properties silently return default values if no matching currency was found. So at least the following snippet won&amp;#39;t cause an earthquake&amp;#58; new Currency&amp;#40;&amp;#41;.IsoNumericCode, but just silently return &amp;#34;0&amp;#34;. For the sake of consistency, i&amp;#39;ve also added Currency.Empty static instance.&lt;br /&gt;&lt;br /&gt;-- Finally, just to simplify a bit working with a huge source file, i&amp;#39;ve moved a part of Currency.cs into partial class file.&lt;br /&gt;Comments: ** Comment from web user: esteewhy ** &lt;p&gt;Ups, also, forgot to tell you&amp;#58; I&amp;#39;ve also created some helper methods to de&amp;#47;serialise Money to&amp;#47;fro string. Just in case smb. w&amp;#39;d be interested...&lt;/p&gt;</description><author>esteewhy</author><pubDate>Fri, 08 May 2009 13:24:21 GMT</pubDate><guid isPermaLink="false">Commented Issue: Code (re)usability improvements 20090508012421P</guid></item><item><title>Created Issue: Code (re)usability improvements</title><link>http://moneytype.codeplex.com/WorkItem/View.aspx?WorkItemId=3628</link><description>Hello, great work&amp;#33; Found you at CodeProject first, than saw the code here, started using it and found some issues worth mentioning&amp;#58;&lt;br /&gt;&lt;br /&gt;-- I&amp;#39;d like to persist Money type as a string in a custom format, so it&amp;#39;s desirable to know if a given currency code is valid in the system. For this case to work i&amp;#39;ve introduced a Currency.TryParse&amp;#40;..&amp;#41; method with a semantic similar to that of some standard CLR value types.&lt;br /&gt;&lt;br /&gt;-- For UI purpose it&amp;#39;d be cool to have a list of all valid currencies, so i&amp;#39;ve exposed it via static Currency.Currencies property&lt;br /&gt;&lt;br /&gt;-- Presently, there&amp;#39;s no way to know if a given Currency instance represents a valid currency until you try to access any instance property and, possibly, get an InvalidOperationException -- ups, not nice&amp;#33; I&amp;#39;ve made these properties silently return default values if no matching currency was found. So at least the following snippet won&amp;#39;t cause an earthquake&amp;#58; new Currency&amp;#40;&amp;#41;.IsoNumericCode, but just silently return &amp;#34;0&amp;#34;. For the sake of consistency, i&amp;#39;ve also added Currency.Empty static instance.&lt;br /&gt;&lt;br /&gt;-- Finally, just to simplify a bit working with a huge source file, i&amp;#39;ve moved a part of Currency.cs into partial class file.&lt;br /&gt;</description><author>esteewhy</author><pubDate>Fri, 08 May 2009 13:21:37 GMT</pubDate><guid isPermaLink="false">Created Issue: Code (re)usability improvements 20090508012137P</guid></item><item><title>Created Issue: Multiply and divide ignore the Currency</title><link>http://moneytype.codeplex.com/WorkItem/View.aspx?WorkItemId=3437</link><description>operator &amp;#42; and operator &amp;#47; both ignore the Currency of the amount being modified and return a Money for the current culture.  Code should be&lt;br /&gt;&lt;br /&gt;        public static Money operator &amp;#42;&amp;#40;Money left, Decimal right&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            return new Money&amp;#40;&amp;#40;&amp;#40;Decimal&amp;#41;left &amp;#42; right&amp;#41;, left._currency&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;        public static Money operator &amp;#47;&amp;#40;Money left, Decimal right&amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;            return new Money&amp;#40;&amp;#40;&amp;#40;Decimal&amp;#41;left &amp;#47; right&amp;#41;, left._currency&amp;#41;&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;thanks for prividing this project&lt;br /&gt;Paul&lt;br /&gt;</description><author>PaulLinton</author><pubDate>Tue, 24 Mar 2009 00:36:06 GMT</pubDate><guid isPermaLink="false">Created Issue: Multiply and divide ignore the Currency 20090324123606A</guid></item><item><title>Created Issue: Formatting errors</title><link>http://www.codeplex.com/MoneyType/WorkItem/View.aspx?WorkItemId=2388</link><description>Hi,&lt;br /&gt;When reviewing your code I found that no matter what currency is set on the Money object, it gets ignored when calling ToString&amp;#40;&amp;#41;, being always the currency corresponding the current Culture. If it happens to be a culture with &amp;#36;, then the corresponding test is passed.&lt;br /&gt;I tried fixing it myself, passing the current  _currency as the IFormatInfo argument, but then it complains heavily about the code used to create the corresponding cultureInfo as it expect a windows Lcid &amp;#40;not Iso number code&amp;#41;.&lt;br /&gt;&lt;br /&gt;Thanks a lot if you happen to look at it, great code, by the way&lt;br /&gt;</description><author>dgon</author><pubDate>Mon, 29 Sep 2008 19:42:36 GMT</pubDate><guid isPermaLink="false">Created Issue: Formatting errors 20080929074236P</guid></item><item><title>New Post: Quick code scan feedback</title><link>http://www.codeplex.com/MoneyType/Thread/View.aspx?ThreadId=32424</link><description>&lt;div style="line-height: normal;"&gt;Hi there codekaizen - a couple of thoughts.&lt;br&gt;
&lt;br&gt;
What you say about System.Decimal isn't really accurate - it's a good
type for representing Money and has the advantage of easily mapping to
a database. Take a look &lt;a href="http://blogs.msdn.com/bclteam/archive/2007/05/29/bcl-refresher-floating-point-types-the-good-the-bad-and-the-ugly-inbar-gazit-matthew-greig.aspx "&gt;here&lt;/a&gt; for a full explanation. How does this money class map to the database?&lt;br&gt;
&lt;br&gt;
Names for simple &lt;a href="http://msdn.microsoft.com/en-us/library/ms229058.aspx"&gt;enums&lt;/a&gt; shouldn't be pluralised.&lt;br&gt;
&lt;br&gt;
You &lt;strong&gt;really &lt;/strong&gt;need the mainline usage code samples on the project home page.
Few people have the time it takes to look at the source code to
initially evaluate this (including me!).&lt;br&gt;
&lt;br&gt;
Thanks! Pete.
&lt;/div&gt;</description><author>sumothecat</author><pubDate>Wed, 20 Aug 2008 11:57:47 GMT</pubDate><guid isPermaLink="false">New Post: Quick code scan feedback 20080820115747A</guid></item><item><title>Source code checked in, #13518</title><link>http://www.codeplex.com/MoneyType/SourceControl/ListDownloadableCommits.aspx</link><description>Fixing static initialization</description><author>codekaizen</author><pubDate>Fri, 01 Aug 2008 19:24:32 GMT</pubDate><guid isPermaLink="false">Source code checked in, #13518 20080801072432P</guid></item><item><title>Source code checked in, #12971</title><link>http://www.codeplex.com/MoneyType/SourceControl/ListDownloadableCommits.aspx</link><description>Adding ISO 4217 currencies list</description><author>codekaizen</author><pubDate>Mon, 28 Jul 2008 20:07:27 GMT</pubDate><guid isPermaLink="false">Source code checked in, #12971 20080728080727P</guid></item><item><title>New Post: Quick code scan feedback</title><link>http://www.codeplex.com/MoneyType/Thread/View.aspx?ThreadId=32424</link><description>&lt;div style="line-height: normal;"&gt;Hey codekaizen,&lt;br&gt;
&lt;br&gt;
As you reported on &lt;a href="http://thinkarchitecture.blogspot.com"&gt;my blog&lt;/a&gt;, we both published a .NET Money implementation on exactly the same day. I’m still amazed! ;) &lt;br&gt;
&lt;br&gt;
I did a quick scan of your implementation this weekend. I really like the completeness of your code. The completeness of the type converters and the implementation of IFormattable.&amp;nbsp; Also, your test suite looks nice and complete.&lt;br&gt;
&lt;br&gt;
By your comment on my implementation, you also got me to think and do some extra research on the best way to store monetary values and the best way to do calculations with them. Reading more, I got to think that it might indeed be wise to follow your path and use a two integers two represent the value (one for the whole number and the other for that fraction). In essence, by using an int64 for the whole number and an int32 for the fraction, you’ve created a fixed point 96 bit decimal. I’m using the regular Decimal type, which is a floating point type. I’m still not sure, however, if it being a floating point type is such a bad thing. First of all, the decimal point can be fixed per object instance. Second, if you need the extra precision, you can have it with the same type. Literature (like &lt;a href="http://www2.hursley.ibm.com/decimal/decifaq1.html#needed"&gt;this from IBM&lt;/a&gt;) suggest a theoretic need for 2191(!) decimal places, but settles for 25-30 decimal places being enough for almost all cases. With the Decimal type you can at least reach a precision of 28 decimal places, but with the two-integer solution you’re always stuck with a maximum precision of 9 decimal places. &lt;br&gt;
&lt;br&gt;
Reading all this, it became clear to me that I got some arithmetic sorting out to do with my implementation, which mainly focuses on easy creation and storage of monetary values. I’m going to puzzle a little more on this for my version 2 implementation.&lt;br&gt;
&lt;br&gt;
Anyway, one last thing: I’m not sure your approach of adding the currency to the monetary value is “inviting” enough. The way a user of your type needs to address a certain currency code seems a little verbose (mainly judging from your tests). Although, in all honesty, I have not gotten around to dive deeply into that yet.&lt;br&gt;
&lt;br&gt;
Keep up the good work!&lt;br&gt;
&lt;br&gt;
Pascal.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;</description><author>plind</author><pubDate>Mon, 28 Jul 2008 19:38:00 GMT</pubDate><guid isPermaLink="false">New Post: Quick code scan feedback 20080728073800P</guid></item><item><title>Source code checked in, #12516</title><link>http://www.codeplex.com/MoneyType/SourceControl/ListDownloadableCommits.aspx</link><description>Adding initial import</description><author>codekaizen</author><pubDate>Fri, 25 Jul 2008 02:05:05 GMT</pubDate><guid isPermaLink="false">Source code checked in, #12516 20080725020505A</guid></item><item><title>Source code checked in, #12515</title><link>http://www.codeplex.com/MoneyType/SourceControl/ListDownloadableCommits.aspx</link><description>Adding svn structure</description><author>codekaizen</author><pubDate>Fri, 25 Jul 2008 02:02:31 GMT</pubDate><guid isPermaLink="false">Source code checked in, #12515 20080725020231A</guid></item></channel></rss>