<p>I would like to be able to do such things as</p>

<pre><code>var m1 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Pounds);
var m2 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Liters);

m1.ToKilograms();
m2.ToPounds(new Density(7.0, DensityType.PoundsPerGallon);
</code></pre>

<p>If there isn't something like this already, anybody interested in doing it as an os project?</p>

[{'answer_id': 54049, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 3, 'selected': True, 'text': '<p>Check out the <a href="http://www.codeproject.com/KB/library/Measurement_Conversion.aspx" rel="nofollow noreferrer">Measurement Unit Conversion Library</a> on The Code Project.</p>\n'}, {'answer_id': 54067, 'author': 'mbillard', 'author_id': 810, 'author_profile': 'https://Stackoverflow.com/users/810', 'pm_score': 2, 'selected': False, 'text': '<p>We actually built one in-house where I work. Unfortunately, it\'s not available for the public.</p>\n\n<p>This is actually a great project to work on and it\'s not that hard to do. If you plan on doing something by yourself, I suggest you read about <a href="http://en.wikipedia.org/wiki/Physical_quantity" rel="nofollow noreferrer">Quantity</a>, <a href="http://en.wikipedia.org/wiki/Dimensional_analysis" rel="nofollow noreferrer">Dimension</a> and <a href="http://en.wikipedia.org/wiki/Units_of_measurement" rel="nofollow noreferrer">Unit</a> (<a href="http://en.wikipedia.org/wiki/Fundamental_units" rel="nofollow noreferrer">fundamental units</a>).</p>\n\n<p>These helped us understand the domain of the problem clearly and helped a lot in designing the library.</p>\n'}, {'answer_id': 54150, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>Also see the most recent F# release - it has static measurement domain/dimension analysis.</p>\n'}, {'answer_id': 54296, 'author': 'rohancragg', 'author_id': 5351, 'author_profile': 'https://Stackoverflow.com/users/5351', 'pm_score': 2, 'selected': False, 'text': '<p>In <a href="https://learning.oreilly.com/library/view/enterprise-patterns-and/032111230X/ch10.html" rel="nofollow noreferrer">Chapter 10. Quantity archetype pattern</a> of the book <a href="http://www.informit.com/store/product.aspx?isbn=9780321112309&amp;aid=3B419801-6640-4A1F-A653-6CD00295FCDD" rel="nofollow noreferrer">Enterprise Patterns and MDA: Building Better Software with Archetype Patterns and UML</a> by Jim Arlow and Ila Neustadt\nthere is a really useful discussion of this topic and some general patterns you could use as a guide.</p>\n'}, {'answer_id': 6321253, 'author': 'denis', 'author_id': 86643, 'author_profile': 'https://Stackoverflow.com/users/86643', 'pm_score': 0, 'selected': False, 'text': '<p>Unix <a href="http://linux.die.net/man/1/units" rel="nofollow">units</a> is imho brilliant; source must be on the web somewhere.<br>\n(Under "bugs", the original doc said "do not base your financial plans on the currency conversions".)</p>\n'}, {'answer_id': 41745573, 'author': 'Peter', 'author_id': 15349, 'author_profile': 'https://Stackoverflow.com/users/15349', 'pm_score': 1, 'selected': False, 'text': '<p>There is an (old) article on <a href="https://www.codeproject.com/Articles/611731/Working-with-Units-and-Amounts" rel="nofollow noreferrer">CodeProject</a>. I\'ve used it in a production environment previously and it worked great. We had some minor issues (performance amongst others), which I addressed. I put all this in a library you can find <a href="https://github.com/petermorlion/RedStar.Amounts" rel="nofollow noreferrer">here</a>.</p>\n\n<p><strong>Disclaimer:</strong> I am the maintainer of this project, so this might be conceived as a shameless plug. The library is free (as in beer and as in speech) however.</p>\n\n<p>It includes the SI units, but also allows creating new units and conversions. </p>\n\n<p>So you can for example create a unit "XP" (experience points). You can then register a conversion to "m" (meter, makes no sense, but you can do it). You can also create an amount like 3 XP/min (3 experience points per minute). I believe it offers decent defaults, while allowing flexibility.</p>\n'}]
['https://Stackoverflow.com/questions/54043', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5056/']