Amenti
Amenti

Reputation: 1560

Cooking Measurements in C# / F#

Do any of you know a library for the representation and calculation of cooking units (Cup, Tablespoon, Gallon...) in C# or F# (especially in regard to culture, metric/imperial)?

Upvotes: 11

Views: 1059

Answers (1)

mavnn
mavnn

Reputation: 9469

Units of measure are built into the F# language:

http://msdn.microsoft.com/en-us/library/dd233243.aspx

They can be easily extended with custom units, as long as you know conversion ratios.

Edit: Of course, you might end up with some strange unit types to account between differences in weights and volumes (the ratio of 1 cup of flour to 1 cup of water is not the same as the ratio of 100g of flour to 100g of water...)

Upvotes: 7

Related Questions