title: Money data type for .NET?
body: <p>Looking for a good <strong>Money data type</strong> for .NET that supports <strong>currencies</strong> and <strong>exchange rates</strong> (with related behaviour &amp; operations). </p>
  
  <ul>
  <li>Note: <em>I started searching for the source code seen in print in the book <a href="http://vig.pearsoned.ca/catalog/academic/product/0,1144,0321146530,00.html" rel="noreferrer">Test-Driven Development By Example</a> by author Kent Beck - he develops a nice Monetary concept. Unable to find the complete source online. The book does not contain one singular listing - instead it develops the source code over the duration of the book.</em></li>
  </ul>
  
  <p>Although the book doesn't go deeper I would also like the Money class to support different <strong>rounding mechanisms</strong> because that also varies among financial institutions around the globe. </p>
  
  <p><strong>Edit 1:</strong> <em>Clarifications</em></p>
  
  <p>By "Money class" I mean a .NET data type that I can use to support money and its operations, complete with currency support and exchange rate calculations. Something like that is a higher level abstraction and might internally use a primitive data type. Also it might rely on a bundle of classes like: Money, ExchangeRate, Bank, etc.</p>
  
  <p>It might be a value type (i.e. struct) or reference type (i.e. class) but either way it would be complete and support the aforementioned features. </p>
  
  <h2>Edit 2: Objectives of Money data type</h2>
  
  <p>(This also shows why a raw decimal, int or other primitive type won't suffice for all Money needs)</p>
  
  <p>Objectives of a Money data type would be:</p>
  
  <ul>
  <li>Safety features (i.e. prevent arithmetic on different currency types).</li>
  <li>Store the currency type with the value (i.e. AUD, US, DKK).</li>
  <li>Store formatting details (i.e. decimal grouping, currency symbols, etc.).</li>
  <li>Conversion providers (e.g. exchange rate) to help round out the solution.</li>
  <li>Reduce multiple currencies in an expression to achieve a result.</li>
  </ul>
  
  <p><strong>Note:</strong> Varying data values like exchange rates can be loaded from an external source and used. This question does not infer anything dynamic is hard-coded into the concept of Money.</p>