Units of measurement conversion logic in C#

Posted by EvanRyan on Stack Overflow See other posts from Stack Overflow or by EvanRyan
Published on 2010-05-07T21:11:56Z Indexed on 2010/05/07 21:18 UTC
Read the original article Hit count: 791

Filed under:
|
|
|

I am adding a feature to my program in which the user will have the ability to change their unit of measurement at any time, and have the program recalculate their input and output.

If the user inputs say, 20lbs for an item, then decides he wants to work in kilograms instead, he can select an option to do so at any time, and the program will recalculate his 20lb input to 9Kg. Then if he decides he'd rather work in ounces, it would convert that 9Kg to 320oz, so on and so forth.

What would be the most effective and efficient way to go about this? I've been racking my brain trying to figure out a way to have the correct formula be implemented.

© Stack Overflow or respective owner

Related posts about c#

Related posts about measurement