UOM classes?

One of the things I haven't seen in the base .net libraries is some kind of unit-of-measure handler.

If you're just measuring distances then Unit and UnitType are there and they're okay, but I haven't seen anything for weight or volume or anything.

It's one of those things I'd expect to change with CultureInfo, but it looks like it might have been a bit beyond the scope of the base libraries.

So I'm wondering if there's something somewhere I can use for this, or if I have to roll my own.

My searches so far lead me to believe that unless I want to go the route of some CRM product (which looks like a lot more than I need) I'll have to make it myself.



Answer this question

UOM classes?

  • juan blanco

    Measure units differ more depending on the context, rather than the culture: technical (usually metric, inches in elecronics, and in music industry), navigation (knot, fathom...) aviation (feet) etc... It's true that there are much culture specific units, but since the variation between the contexts, its hard to define a culture specific unit set. And I think that metric system is more or less taking over, it makes definition even more hard. These all was just my opinions by the way:)

    Since measurements depend hard on the context, it's logical that you create measure code yourself, and fit it into your aplication context.

  • Brett Samblanet

    Quite true.

    However, since the metric system is the world standard, I would kind of expect there to be some optional Metric.dll library or something. Some set of base classes that you can make an instance of to track a metric value and then call the "instance string ToString( UnitType.Imperial )" method to get 5'3" returned.

    Or something. Anything, really. Just not the "nothing" I've been able to find.

    I'm not saying I'd expect to find this in System.dll, but I did kind of expect there to be a library download somewhere...

    Maybe not, though. 8 )


  • UOM classes?